#include<stdio.h>
#include<stdbool.h>
#include<conio.h>
#include<math.h>
#include<string.h>
void main()
{
int number;
int i, surplus, sum;
printf("enter number: "); // nhập số cần đảo ngược
scanf("%d", &num);
printf("how many digits in the entered number : ");
scanf("%d", &sum);
printf("reversed number of %d is ", num);
for (i = 1; i <= sum;i++)
{
surplus = num%10; // tìm số dư của số đã cho và in lần lượt sẽ được số đảo ngược
printf("%d", surplus);
num = num/10;
}
getch();
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter