Playing With Characters in C HackerRank

Task

You have to print the character, in the first line. Then print in the next line. In the last line print the sentence.

Sample Input 0

C
Language
Welcome To C!!

Sample Output 0

C
Language
Welcome To C!!

Program:

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX_LIMIT 40
int main()
{
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
char ch;
char s[MAX_LIMIT];
char sen[MAX_LIMIT];
scanf("%c",&ch);
scanf("%s",&s);
scanf("\n");
scanf("%[^\n]%*c", sen);
printf("%c\n%s\n%s",ch,s,sen);
return 0;
}

Leave a Comment