I am trying to write a simple code.
I should enter 10 letters using getchar
and after print the smallest.
Ex. 'A' is 65 in ASCII and if I enter 'A', it should print that 'A' is smallest.
I have done the first part where I should enter the letters and something in my for loop is breaking.
This is my code:
#include <stdio.h>
int main(void)
{
char ch;
int i;
for(i=0; i<10; i++) {
ch = getchar;
printf("You entered : %c\n", ch);
}
return 0;
}
Using the program I get this five times:
a
You entered : a
You entered :