0

How can i make this at C programme?

Please enter a number here - - > 456 456=400+50+6

22nd Oct 2019, 5:51 PM
Elvin Namazov
9 ответов
22nd Oct 2019, 8:39 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
Show us your attempts please. Idea: consider dividing on 10
22nd Oct 2019, 6:01 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
I didn't know C was this complicated, I literally did this with python in a one-liner code including everything, but I had to create many functions in C to make this simple script, wow!
22nd Oct 2019, 7:34 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Next time please write the code in the code playground, then save it. Come back to this post, and click insert code -> my codes, and then select your code you just saved.
22nd Oct 2019, 6:15 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Your code works fine, but ONLY with 3 digit numbers, you have to make a while loop, so it does the process untill a condition is reached. Tru to figure it out
22nd Oct 2019, 6:23 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
#include <stdio.h> #include <stdlib.h> int main(){ char operation; int number; int temp1; int temp2; printf("\n\t\tPlease enter number here -->\t" ); scanf("%d", &number ); printf("%d", number); scanf("%c", &operation); printf("%c%d ",'=', number /100*100 ); temp2 = number %100; printf("%c%d ",'+', temp2 /10*10 ); temp1 = temp2 %10; printf("%c%d ",'+', temp1 /1*1 ); return 0; } I write like this, but i think there's some mistake, that i can't find.
22nd Oct 2019, 6:10 PM
Elvin Namazov
22nd Oct 2019, 6:19 PM
Elvin Namazov
0
I got an idea of finding this.If u feel that this one's good or can be better , feel free to reply. Program: /*This program is for three digit number.You can input 456*/ void main() { int x[3],i; for( i ; i<=2; ++i) { cout<"enter the value of x"; cin>>x[i]; } a=x[0]; b=x[1]*10; c=x[2]*100; cout<<c<<"+"<<b<<"+"<<a; getch(); }
23rd Oct 2019, 9:18 AM
Rohith
Rohith - avatar
23rd Oct 2019, 10:15 AM
Dhawal Mehta
Dhawal Mehta - avatar