WAP for concatenation two strings without using string.h header file ?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
main()
{
int n,i,c,flag,j;
c=1;
char string[100],a[100],ch;
printf("enter a string");
scanf("%s",string);
printf("%s",string);
n=strlen(string);
printf("%d\n",n);
a[0]=string[0];
for(i=1;i<n;i++)
{
flag=1;
ch=string[i];
for(j=0;j<=i;j++)
{
if(a[j]==ch)
flag=0;
}
if(flag==1)
{
c++;
a[i]=string[i];
}
}
printf("%d\n",count);
system("pause");
}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
main()
{
int n,i,c,flag,j;
c=1;
char string[100],a[100],ch;
printf("enter a string");
scanf("%s",string);
printf("%s",string);
n=strlen(string);
printf("%d\n",n);
a[0]=string[0];
for(i=1;i<n;i++)
{
flag=1;
ch=string[i];
for(j=0;j<=i;j++)
{
if(a[j]==ch)
flag=0;
}
if(flag==1)
{
c++;
a[i]=string[i];
}
}
printf("%d\n",count);
system("pause");
}
No comments:
Post a Comment