Write a program that prints the alphabet in lowercase, followed by a new line.Print all the letters except q and eYou can only use the putchar function (every other function (printf, puts, etc…) is forbidden)All your code should be in the main functionYou can only use putchar twice in your code
Question
Write a program that prints the alphabet in lowercase, followed by a new line.Print all the letters except q and eYou can only use the putchar function (every other function (printf, puts, etc…) is forbidden)All your code should be in the main functionYou can only use putchar twice in your code
Solution
Here is a simple program in C that meets your requirements:
#include <unistd.h>
int main() {
char letter;
for (letter = 'a'; letter <= 'z'; letter++) {
if (letter != 'q' && letter != 'e') {
write(1, &letter, 1);
}
}
write(1, "\n", 1);
return 0;
}
This program uses a loop to iterate over all lowercase letters. If the current letter is not 'q' or 'e', it is printed using the write function. After all letters have been printed, a newline character is printed.
Similar Questions
Write a program that prints the ASCII alphabet, in lowercase, not followed by a new line.You can only use one print function with string formatYou can only use one loop in your codeYou are not allowed to store characters in a variableYou are not allowed to import any module
Write a program that prints all the numbers of base 16 in lowercase, followed by a new line.You can only use the putchar function (every other function (printf, puts, etc…) is forbidden)All your code should be in the main functionYou can only use putchar three times in your code
Write a C program to read an English Alphabet through keyboard and display whetherthe given alphabet is in upper case or lower case.
Write a program to check whether a given character is Alphabet or not using if else statement Note: Check for both upper and lower case characters
Write a program that accepts an input string from the user and prints the total number of alphabet characters (A-z) in the string to the output.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.