dixit


{ City }
< Country > india
* Profession *
User No # 99307
Total Questions Posted # 0
Total Answers Posted # 2

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 0
Users Marked my Answers as Wrong # 1
Questions / { dixit }
Questions Answers Category Views Company eMail




Answers / { dixit }

Question { 2971 }

write a program which asks the user for a digit INTEGER and
outputs show in 5 digit .
example user enter :89 and output should be 00089


Answer

#include
#include
using namespace std;
int main()
{
int n,i=0,m;
scanf("%d",&n);
m=n;
if(m==0)
{
printf("00000");
return 0;
}
while(n)
{
n/=10;
i++;
};
while(5-i)
{
printf("0");
i++;
};
printf("%d",m);
return 0;
}

Is This Answer Correct ?    0 Yes 0 No

Question { 2828 }

Write a program which asks user for digit and output as 5
digit number (prefix as 0).
example : 89 o/p should be 00089


Answer

#include
#include
using namespace std;
int main()
{
int n,i=0,m;
scanf("%d",&n);
m=n;
if(m==0)
{
printf("00000");
return 0;
}
while(n)
{
n/=10;
i++;
};
while(5-i)
{
printf("0");
i++;
};
printf("%d",m);
return 0;
}

Is This Answer Correct ?    0 Yes 1 No