0
How can i make this at C programme?
Please enter a number here - - > 456 456=400+50+6
9 ответов
+ 3
https://code.sololearn.com/cTXp18nxy6NO/?ref=app
Elvin Namazov i added + between the numbers now
+ 2
Show us your attempts please.
Idea: consider dividing on 10
+ 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!
+ 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.
+ 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
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.
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();
}