Im making a program which converts meters into decimeters and then centimeters, and want to show it as for example 3m=30dm=300cm like that but i have no idea why my code is not working
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <stdio.h>
#include <conio.h>
void main()
{
int x,cm,dm;
printf("Input number in meters!" );
scanf("%d",&x);
dm=x/10;
x=x%10;
cm=x/100;
x=x%100;
printf("%d=%d=%d=",x,dm,cm);
getch();
}
I mean it does but the program doesn't do any math, why?
#include <stdio.h>
#include <conio.h>
int main()
{
int x,cm,dm;
printf("Input number in meters!" );
scanf("%d",&x);
dm=x*10;
cm=x*100;
printf("%d=%d=%d=",x,dm,cm);
getch();
}
'%'--the modulo operator, returns the reminder of an equation.
int eg=10%3;eg will be 1 because 3 goes into 10 3 times, reminder 1