linux - Comparing four numbers in C -
i wrote simple digits comparison program in c, while compiling throwing me error message stating
**/tmp/ccx3x0ai.o: in function `main': 3e.c:(.text+0x11): undefined reference `printf' collect2: ld returned 1 exit status**
the program
**#include<stdio.h> int main() { int a, b, c, d ; printf ( "enter 4 numbers" ) ; scanf ( " enter 1) %d, \n enter 2) %d, \n enter 3) %d, \n enter 4) %d ", &a , &b, &c, &d ) ; if ( >= b ) { if ( c >= d ) { if ( c >= ) { printf ( "enter c greater" ) ; } else { printf ( "enter greater" ) ; } } else { if ( d >= a) { printf ( "enter d greater" ) ; } else { printf ( "enter greater" ) ; } } } else { if ( c >= d ) { if ( c >= b) { printf ( "enter c greater" ) ; } else { printf ( "enter b greater" ) ; } } else { if ( d >= b ) { printf ( "enter d greater" ) ; } else { printf ( "enter b greater" ) ; } } } } **
i'm not sure point error. @ same time i'm trying write same code using conditional operators in c.
you have typo in middle line here:
int a, b, c, d ; printf ( "enter 4 numbers" ) ; scanf ( " enter 1) %d, \n enter 2) %d, \n enter 3) %d, \n enter 4) %d ", &a , &b, &c, &d ) ;
it should small p in printf
=> printf
Comments
Post a Comment