+ 2

where is the error in this code?

//print alphabets in descending order and without vowels. #include <stdio.h> int main(){ char ch; printf("Alphabets in Decending order.\n"); for(ch='Z';ch>='A';ch--) { if((ch='A')|| (ch='E') || (ch='I') || (ch='O') || (ch ='U')) { printf(" "); } else { printf("%c",ch); } } return 0; }

6th Jan 2019, 2:23 PM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar
2 Answers
+ 8
To test an equality, it's the two operators ==. Don't forget : = to assign a value == to test an equality So : if((ch=='A')||... ) { }
6th Jan 2019, 2:32 PM
Théophile
Théophile - avatar
+ 1
Thanks mate
6th Jan 2019, 3:07 PM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar