Guys, i am trying to write a C program that checks the greater of two input numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys, i am trying to write a C program that checks the greater of two input numbers

#include<stdio.h> #include<conio.h> int main() { int a, b, big; printf("Enter any two number: "); scanf("%d%d", &a, &b); if(a>b) big=a; else big=b; printf("\nBiggest of the two number is: %d", big); getch(); return 0; }

2nd Jan 2021, 9:40 AM
Jurence
Jurence - avatar
2 Answers
+ 2
The conio.h header file is obsolete and does not come with mordern compilers. Also, you don't need it anywhere in your code. So just remove the line `#include<conio.h>` and also the line `getch()` because the getch function is found in conio.h
2nd Jan 2021, 9:50 AM
XXX
XXX - avatar
+ 2
you don't need getch() here. check this to see when to use it: https://stackoverflow.com/questions/13677253/what-exactly-getch-does-in-c
2nd Jan 2021, 9:58 AM
Mohamed Kharma
Mohamed Kharma - avatar