The program compiles ,the output is:Code:#include <stdio.h> main() { int num,rem,rev=0; printf ("Enter the number to be reversed:\n"); scanf ("d",&num); while (num>=1) { rem = num % 10; rev = (rev*10) + rem; num = num/10; } printf("The reverse of number is %d\n",rev); ; }
output:
Enter the number to be reversed:
123
The reverse of number is 26.
press any key to continue
The output should be
Enter the number to be reversed:
123
The reverse of number is 321.
press any key to continue
---------------------------------------------------------------------------
Warnings and errors:
-------------- Build: Debug in reverse (compiler: GNU GCC Compiler)---------------
mingw32-gcc.exe -Wall -g -c C:\Users\Ram\Documents\reverse\main.c -o obj\Debug\main.o
C:\Users\Ram\Documents\reverse\main.c:3:1: warning: return type defaults to 'int' [-Wreturn-type]
C:\Users\Ram\Documents\reverse\main.c: In function 'main':
C:\Users\Ram\Documents\reverse\main.c:8:5: warning: too many arguments for format [-Wformat-extra-args]
C:\Users\Ram\Documents\reverse\main.c:18:1: warning: control reaches end of non-void function [-Wreturn-type]
mingw32-g++.exe -o bin\Debug\reverse.exe obj\Debug\main.o
Output file is bin\Debug\reverse.exe with size 28.71 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 3 warning(s) (0 minute(s), 0 second(s))
-------------- Run: Debug in reverse (compiler: GNU GCC Compiler)---------------
Checking for existence: C:\Users\Ram\Documents\reverse\bin\Debug\reverse.e xe
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Users\Ram\Documents\reverse\bin\Debug\reverse. exe" (in C:\Users\Ram\Documents\reverse\.)