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 Posted / dixit13bal

#include<iostream>
#include<stdio.h>
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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

No New Questions to Answer in this Category !!    You can

Post New Questions

Answer Questions in Different Category