If else statement
#include <stdio.h>
int main ()
{
char ch;
int count_a=0, count_b=0, count_c=0, count_other=0;
while (ch = getchar ( ) != '\n')
{
if (ch=='a')
++count_a;
else if (ch=='b')
++count_b;
else if (ch=='c')
++count_c;
else
++count_other;
}
}
- pls help me correct the code
- convert into switch-case statement
Aucun commentaire:
Enregistrer un commentaire