write a c program to reverse a given number
Answers
Answered by
3
C program to find reverse of a number
1. #include <stdio.h>
2. int main()
3. {
4. int n, reverse = 0;
5. printf("Enter a number to reverse\n");
scanf("%d", &n);
6. while (n != 0)
{
7. reverse = reverse * 10;
reverse = reverse + n%10;
8. n = n/10;
9. }
10. printf("Reverse of entered number is = %d\n", reverse);
11. return 0;
12. }
1. #include <stdio.h>
2. int main()
3. {
4. int n, reverse = 0;
5. printf("Enter a number to reverse\n");
scanf("%d", &n);
6. while (n != 0)
{
7. reverse = reverse * 10;
reverse = reverse + n%10;
8. n = n/10;
9. }
10. printf("Reverse of entered number is = %d\n", reverse);
11. return 0;
12. }
jeevan8701:
output
Similar questions
Chemistry,
7 months ago
English,
7 months ago
Computer Science,
7 months ago
History,
1 year ago
CBSE BOARD XII,
1 year ago