Advertisement

This is a string. It input two words & output how many words and add of that two words


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{   clrscr();
    char a[50],b[50],c[100];
    int i,j,m,n;
    printf("Enter 1st name:");
    gets(a);
    printf("Enter 2nd name:");
    gets(b);
    m=strlen(a);
    n=strlen(b);
    printf("%d %d\n",m,n);
    for(i=0;i<m;i++)
   { c[i]=a[i]; }
    for(j=0;j<n;j++)
   { c[i]=b[j];
   i++;}
    c[i]='\0';
    puts(c);
    getch();}

No comments:

Post a Comment

Please comment bellow. Share your knowledge