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
Explain data types & how many data types supported by c?
Explain what is wrong in this statement?
What is a 'null pointer assignment' error?
Lists the benefits of c programming language?
What is printf () in c?
Explain the difference between malloc() and calloc() in c?
The difference between printf and fprintf is ?
How is null defined in c?
Can we declare variables anywhere in c?
What does c in a circle mean?
Explain union. What are its advantages?
What does 4d mean in c?
What are the 4 data types?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
What are the modifiers available in c programming language?