Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

write a programme that take a 6 digit integer and decompress it as ddmmyy format.

0 votes
asked Jun 7, 2018 by codeman x.
For eg.

090994

your code should decompress it to: dd = 9, mm = 9 and yy = 94.

3 Answers

0 votes
answered Jun 8, 2018 by anonymous
#include<iostream>

using namespace std;

main()

{

int a,b,c,d,e,f;

cin>>a>>b>>c>>d>>e>>f;

cout<<"dd:"<<a<<b<<"\t";

cout<<"mm:"<<c<<d<<"\t";

cout<<"yy:"<<e<<f<<"\t";

}
commented Jun 11, 2018 by shubham
#include<iostream>
using namespace std;
int main()
{
while(1){
    int n;
cin>>n;
if(n%1000000==n){
cout<<"dd"<<n%100<<"     ";
n=n/100;

cout<<"mm"<<n%100<<"     ";
n=n/100;

cout<<"yy"<<n%100<<"     ";
n=n/100;
break;
}
else
cout<<"ENTER CORRECT NUMBER";
}}
+2 votes
answered Jun 11, 2018 by shubham

#include<iostream>
using namespace std;
int main()
{
while(1){
    int n;
cin>>n;
if(n%1000000==n){
cout<<"dd"<<n%100<<"     ";
n=n/100;

cout<<"mm"<<n%100<<"     ";
n=n/100;

cout<<"yy"<<n%100<<"     ";
n=n/100;
break;
}
else
cout<<"ENTER CORRECT NUMBER";
}}

0 votes
answered Jun 19, 2018 by Alaris
#include <stdio.h>

int main(void)
{
    int dd, mm, yy;
    scanf("%2d%2d%2d", &dd, &mm, &yy);
    printf("%d/%d/%d\n", dd, mm, yy);

    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...