simple program:
#include<stdio.h>
void main()
{
char a[100];
int i=0,m=0,j=0;
printf("enter the sentence : \n");
while(i<100)
{
scanf("%c",&a[i]);
if(a[i]=='\n') break;
i++;
}
printf("words are: \n");
for(j=0;j<i;j++)
{
if(a[j]==' ') printf("\n");
else printf("%c",a[j]);
}
}
-----------------------------------------------------------------------------------------------------------
#include<stdio.h>
void main()
{
char a[100];
int i=0,m=0,j=0;
printf("enter the sentence : \n");
while(i<100)
{
scanf("%c",&a[i]);
if(a[i]=='\n') break;
i++;
}
printf("words are: \n");
for(j=0;j<i;j++)
{
if(a[j]==' ') printf("\n");
else printf("%c",a[j]);
}
}
-----------------------------------------------------------------------------------------------------------
No comments:
Post a Comment