0
Compare two three-digit number
I want to compare two three-digit numbers in two lines in reverse. For example 127 to 721 compares with another number like 260 which is actually 062 and gives an output: 260 <127 Why my code isn't working correctly? https://code.sololearn.com/cZgvVK1ULU37/?ref=app https://code.sololearn.com/cZgvVK1ULU37/?ref=app
5 odpowiedzi
+ 2
Its not the algorithm i'd use but.
Change this statement:
scanf("%d%d%d\n%d%d%d",&a,&b,&c,&d,&e,&f);
Here each %d is ready a number until a blank space ia encountered
To
scanf("%1d%1d%1d\n%1d%1d%1d",&a,&b,&c,&d,&e,&f);
%1d means it will only read one digit integer number.
+ 1
Arturop Wow! I didn't know..
Thanks a lot 💐😊
0
it works, what error did you get?
your code has 6 inputs, you have to enter each one in a new line like.
1
2
3
4
5
6
then submit
0
Bahha🐧 No,inputs are already defined.
0
Shakiba Majd you will get the same results.
the difference is whether you have to enter them like I mentioned or in one line if you change it to the code above.