Pages

Thursday, 3 July 2014

Write a C program to read in a three digit number produce following output. (assuming that the input is 347) 3 hundreds 4 tens 7 units.

#include<stdio.h>
#include<conio.h>
int main(void)
{
clrscr();
int no,hun,ten,unit;
printf("Please enter 3-digit number : ");
scanf("%d",&no);
hun=no/100;
no=no%100;
ten=no/10;
unit=no%10;
printf("%d Hundred \n%d ten \n%d unit",hun,ten,unit);
getch();
return 0;
}

2 comments: