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.
+ 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
+ 1
What do you need help with? Also z is an int not string
+ 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)