For some reason, my code isn’t working in C.
Please check the code below:
#include <stdio.h>
#include <string.h>
int main(){
while (1){
printf(“Is Python a programming language? “);
char question[4];
scanf(“%s”, &question);
if (strcmp(question, “yes”) == 0 || (strcmp(question, “YES”) == 0 || (strcmp(question, “Yes”) == 0 ))){ //the reason why I’m using so many “or” statements is because idk how to lowercase the input (pls help me if you can)
printf(“Correct”);
} else {
printf(“Incorrect”);
continue;
}
}
Aucun commentaire:
Enregistrer un commentaire