Like mentioned in a comment skip everything between Z for example this way:
#include "stdio.h"
int main(){
char ch = 'A';
while(ch <= 'z'){
if(ch <= 'Z' || ch >= 'a'){
printf("%c", ch);
}
ch++;
}
printf("\n");
return 0;
}
or alternatively use a for
loop since you know the beginning and end of the range of values:
#include "stdio.h"
int main(){
char ch;
for(ch = 'A'; ch <= 'z'; ch++){
// loop through range of ASCII values from 'A' to 'z', upper case
// and lower case letters, and print out only alphabetic characters.
if(ch <= 'Z' || ch >= 'a'){
// character is in range of 'A' thru 'Z' or 'a' thru 'z'.
printf("%c", ch);
}
}
printf("\n");
return 0;
}
or alternatively use the isalpha()
function to detect if a character is alphabetic or not.
#include "stdio.h"
int main() {
char ch;
// loop through range of ASCII values from 'A' to 'z', upper case
// and lower case letters, and print out only alphabetic characters.
for (ch = 'A'; ch <= 'z'; ch++) isalpha (ch) && printf ("%c", ch);
printf("\n");
return 0;
}