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
Can you mix old-style and new-style function syntax?
How is a structure member accessed?
explain what is a newline escape sequence?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
What is the difference between struct and typedef struct in c?
What is FIFO?
What are the benefits of organizational structure?
Can the sizeof operator be used to tell the size of an array passed to a function?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
Are global variables static in c?
what will be maximum number of comparisons when number of elements are given?
Who invented b language?
Can we declare a function inside a function in c?
What is linear search?
Compare interpreters and compilers.