In: Computer Science
This is meant to be done in C. Write a program using putchar() and getchar() that reads characters form the keyboard and write to the screen. Every letter that is read should be written three times and followed by a newline. Any newline that is read should be disregarded. All other characters should just be copied to the screen.
I am stuck on this any help please?
Provided code is done as per your requirements.
Code Image:

Sample Output:

Code to Copy:
#include <stdio.h>
int main(){
//Declare character as type char
char character;
//Declare j as type of integer
int j;
// Iterate the while loop
// to enter character repeatedly
while(1){
//get character
character = getchar();
//Check if character is of type new line or not
if(character != '\n'){
//write 3 times on screen of the enterered character
//Iterate the loop
j = 0;
while(j < 3){
putchar(character);
j++;
}
//Display new line after the written of 3 characters
putchar('\n');
}
}
return 0;
}