how to find out the reverse number of a digit if it is
input through the keyboard?
Answer Posted / haris
Try it. It will seriously work. You would appreciate it.
#include<stdio.h>
#include<conio.h>
int main()
{
int x;
int a,b,c,d,e,f,g,h,i;
int sum;
printf("Please enter a five digit number:\n");
scanf("%d",&x);
a=x%10;
b=(x/10)% 10;
c=(x/100)% 10;
d=(x/1000)%10;
e=(x/10000)%10;
f=a*10000;
g=b*1000;
h=c*100;
i=d*10;
sum=f+g+h+i+e;
printf("\n\nThe sum of all digits is %d.",sum);
getch();
return 0;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is auto keyword in c?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
What is nested structure in c?
What are type modifiers in c?
Tell me what are bitwise shift operators?
What is this pointer in c plus plus?
What are different storage class specifiers in c?
How do you search data in a data file using random access method?
How do you determine whether to use a stream function or a low-level function?
If null and 0 are equivalent as null pointer constants, which should I use?
Why array is used in c?
What are variables and it what way is it different from constants?
What are the different types of endless loops?
Using which language Test cases are added in .ptu file of RTRT unit testing???
Explain how are portions of a program disabled in demo versions?