1. WAP in c to accept and print your name
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[100];
clrscr();
printf("Enter your name:");
gets(a);
printf("\nyour name is ");
puts(a);
getch();
}
Output:
2. WAP in c to find the length of string
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[100];
int len;
clrscr();
printf("Enter any string:");
gets(a);
len=strlen(a);
printf("\nLength of string is %d",len);
getch();
}
output:
3. WAP in c to copy one sring into another
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[100],b[100];
clrscr();
printf("Enter any string:");
gets(a);
strcpy(b,a);
printf("\ncopied string in other array is ");
puts(b);
getch();
}
output:
4. WAP in c to concatnate two strings
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[100],b[100];
clrscr();
printf("Enter first string:");
gets(a);
printf("\nEnter second string:");
gets(b);
strcat(a,b);
printf("\nconcatenated strings are ");
puts(a);
getch();
}
output:
5. WAP in c to find reverse of a string
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[100];
clrscr();
printf("Enter any string: ");
gets(a);
strrev(a);
printf("\nReverse of a string is ");
puts(a);
getch();
}
output: