Ok, i mean "can you reverse the number" is the numer already reverse by using Mod(%) my question, can it reverse to normal
example, you enter the number with "2552" it'll change to "2+5+5+2", i mean this is the right answer, but, when you enter another number like "4125" it will change to "5+2+1+4" not "4+1+2+5"
Ok, I just entered the programming world, a newcomer
Hm, with the "if" can it add "+" without exceeding the number like "4+1+2+5+" there are "+" after "5" can delete this "+"?
#include <stdio.h>
main(){
int a, b, h=0;
printf("Enter the number : ");
scanf("%d",&a);
printf("%d = ", a);
while(a != 0)
{
b=a%10;
a=a/10;
printf("%d",b);
if(b != a)
{
printf("+");
}
h=h+b;
}
printf(" = %d\n", h);
}
Aucun commentaire:
Enregistrer un commentaire