Playing With Characters

Write a program to take a character, a string, and a sentence as input in C.

C Program

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main()
{
    char ch = 'C's[20], s1[100];
    scanf("%c", &ch);

    scanf("%s"s);
    scanf("\n");

    scanf("%[^\n]%*c"s1);

    printf("%c\n"ch);
    printf("%s\n"s);
    printf("%s\n"s1);
    return 0;
}

Input:

C Language Welcome To C!!
Output:

C Language Welcome To C!!


No comments:

Post a Comment