GoogelAddUnit1

Monday 16 April 2012

WRITE A C-PROGRAM TO CONCATINATE ANY THREE STRINGS.

AIM:A program to concatinate any three strings.


PROGRAM:
#include<stdio.h>
main()
{
int i,j,k;
char a[20],b[20],c[20],d[20];
printf("enter the three strings");
scanf("%s%s%s",a,b,c);
for(i=0;a[i]!='\o';i++)
d[i]=a[i];
d[i]=' ';
for(j=0;b[j]!='\o';j++)
d[i+j+1]=b[j];
d[i+j+1]=' ';
for(k=0;c[k]!='\o';k++)
d[i+j+k+2]=c[k];
d[i+j+k+2]='\o';
printf("the new string is%d",d);
}

OUTPUT:
enter the three strings

the new string is

No comments:

Post a Comment