Program to print the entered sentence || string manipulation in C || C programming
In this we are going to see a program which reads a whole line and prints it again in C Programming Language.

//Program to read a sentence and print it again
#include <stdio.h>

int main()
{
    char line[81], character;
    int count;
    count = 0;
    printf("Enter a sentence: ");

    do
    {
        //input a sentence
        character = getchar();
        line[count] = character;
        count++;
    } while (character != '\n');

    count = count - 1;
    line[count] = '\0';

    //print a sentence
    printf("\n%s\n", line);

    return 0;
}

//..........coded by ANANYA MAURYA

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post