0
if else statement not working with getchar()
#include <stdio.h> int main() { int score = getchar(); if (score >= 90) printf("Top 10%%.\n"); else printf("Less than 90.\n"); return 0; } it gives "less than 90" for all inputs. please help and explain thanks
3 odpowiedzi
+ 2
score is interger value then why you are taking Input using getchar()
Go here and check again how to take integer input
https://www.sololearn.com/learn/C/2914/
+ 1
Understood thanks
0
Getchar is only for getting character , simply take scanf()