//C program used to reverse an integer,count the no. of digits and calculate sum
#include < stdio.h>
#include < string.h>
#include < conio.h>
void main()
{
static char num[1000];
int sum=0;
int i=0,n=0;
printf("Enter the number:");
gets(num);// a=gets();
n=strlen(num);
printf("No of Digits=%d",n);
for(i= n-1;i> =0;i--)
{
printf("%c",num[i]);
}
printf("sum of digits:");
for(i=0;i< n;i++)
sum+= num[i];
printf("%d", sum);
getch();
}
Thursday, September 4, 2008
C Program to REVESE AN INTEGER
Posted by Nanya at 7:26 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment