#include <ctype.h> #include <stdio.h> #include <conio.h> int main(void) { char input[50]; char i; int j = 0; printf("Please enter a sentence: "); fgets(input, 50 , stdin); for (j = 0; input[i] != '\0'; j++) if (input[i]=='a'||input[i]=='e'||input[i]=='i'||input[i]=='o'||input[i]=='u') { input[i]=toupper(input[i]); printf("Your new sentence is: %s", input); } else if (input[i]=='A'||input[i]=='E'||input[i]=='I'||input[i]=='O'||input[i]=='U') { input[i]=tolower(input[i]); printf("Your new sentence is: %s", input); } return 0; }
This is not my homework . I am new to C. I canโt find out the error in my code, I have googled it, but canโt find any useful data that can fix my error. ERROR, I get printf ("Your new sentence:% s", input); ----> this line does not perform any actions, and I appreciate if someone corrects my error.
INPUT - enter a sentence I'm new to c
Desired exit - Your new offer: I Am A BEgInnEr In c
ACTUAL OUTPUT - // empty string //
thanks
source share