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 Posted / dixit_me
#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 | 1 No |
Post New Answer View All Answers
No New Questions to Answer in this Category !! You can
Post New Questions
Answer Questions in Different Category