Hackerrank Playing With Characters Solution in c
Watch Video:
Code::
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
//first step is to create variables
char ch;//character
char s[128];//for string with maximum size i.e 128
char sen[128];//sentence
//second step for scanning
scanf("%c",&ch);//for charaacter
scanf("%s\n",&s);//for string
scanf("%[^\n]%*c",&sen);//for sentence
//third step for printing
printf("%c\n",ch);//for printing char
printf("%s\n",s);//for printing string
printf("%s\n",sen);//for printing sentence
return 0;
}
Comments
Post a Comment