Friday, November 23, 2012

ACCEPT N WORDS (WHICH FORM A SENTENCE), ONE WORD AT A TIME. OUTPUT IT ON THE SCREEN AS A SENTENCE WITH BLANKS BETWEEN WORDS, AND A FULLSTOP AT THE END.


/* ACCEPT N WORDS (WHICH FORM A SENTENCE), ONE WORD AT A TIME.
    OUTPUT IT ON THE SCREEN AS A SENTENCE WITH BLANKS BETWEEN WORDS, AND A FULLSTOP AT THE END.
*/
#include<stdio.h>
#include<conio.h>

#define ROW 20
#define COL 30

void main()
{
            char words[ROW][COL];
            int i,j,n;
            clrscr();
            printf("Enter number of words : ");
            scanf("%d",&n);

            for(i=0;i<n;i++)
            {
                        printf("Enter %d word : ",i+1);
                        scanf("%s",&words[i]);
            }
            printf("\n The sentence is :\n\t\t");
            for(i=0;i<n;i++)
            {
                        printf(" ");
                        printf("%s",words[i]);
            }
            printf(".");
            getch();
}

/*
            =====OUT OUT=====

     1. Enter number of words : 3
            Enter 1 word : I
            Enter 2 word : LOVE
            Enter 3 word : INDIA

             The sentence is :
                             I LOVE INDIA.
  
*/

0 comments:

Post a Comment