4th Apr 2018, 3:48 PM
PRASHANT Mishra
PRASHANT Mishra - avatar
4 Answers
+ 3
By the way, in your ternary operator, you simply forgot to put printf in front of the () for each condition. As a result, it wasn't able to print you the result you were seeking. Also, you placed your 'new line' at the beginning of your strings, rather than the end, so I fixed that and made the string descriptions a bit more descriptive.
4th Apr 2018, 4:09 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 2
https://code.sololearn.com/c7sLtS18bxAv/#c #include <stdio.h> #include <conio.h> int main() { int x,y,z; printf("Enter First Number: \n"); scanf("%d",&x); printf("Enter Second Number: \n"); scanf("%d",&y); z= x>y ? printf("Highest Number: %d",x) : printf("Highest Number: %d",y); return 0; } :::: INPUT :::::: 2 8 :::: OUTPUT :::::: Enter First Number: Enter Second Number: Highest Number: 8
4th Apr 2018, 3:59 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 1
What do you need help with? Also z is an int not string
4th Apr 2018, 3:57 PM
TurtleShell
TurtleShell - avatar
+ 1
The z doesn't have any purpose. Except you want to check if the printf was successful (or want to know the number of characters printed)
4th Apr 2018, 4:19 PM
Alex
Alex - avatar