Why this is causing error ? How to resolve it | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Why this is causing error ? How to resolve it

#include <stdio.h> int main() { int a=10, b=3,max; a>b ? max=a : max=b; printf("%d\n",max); return 0; }

30th Aug 2019, 1:52 PM
Preity
Preity - avatar
2 Réponses
+ 7
Line 3 should be like this: Max = a > b ? a : b;
30th Aug 2019, 2:13 PM
Eliya Ben Baruch
Eliya Ben Baruch - avatar
+ 1
devanille by adding parenthesis what the reason so the code is executed correctly
30th Aug 2019, 3:42 PM
Preity
Preity - avatar