String copy

Program:

#include<stdio.h>
int main()
{
char s1[20],s2[20];
int len=0,i;
printf("Enter String: ");
scanf("%s",s1);
while(s1[len]!='\0')
{
len++;
}
for(i=0;i<=len;i++)
{
s2[i]=s1[i];
}
printf("String s2: %s",s2);
return 0;
}

Output:



No comments:

Post a Comment

x^y using recursion

Program: #include<stdio.h> int power(int a,int b); int main() { int x,y,ans; printf("Enter x and y:\n "); scanf(...