Friday, November 21, 2014

C using pro



Concat Two Strings Using Library Function

#include
#include
#include
int main()
{
   char str1[100];
   char str2[100];
   char str3[100];
   int len;
   printf("\nEnter the String 1 : ");
   gets(str1);
   printf("\nEnter the String 2 : ");
   gets(str2);
   strcpy(str3, str1);
   strcat(str3, str2);
   printf("\nConcated String : %s", str3);
   return (0);
}

C Program to Copy one string into other with using library function

#include
#include
#include
int main()
{
   char str1[100];
   char str2[100];
   printf("\nEnter the String 1 : ");
   gets(str1);
   strcpy(str2, str1);
   printf("\nCopied String : %s", str2);
   return (0);
}

Output

Enter the String 1 : c4learn
Copied  String : c4learn

Convert Given String into Lowercase Using Library Function

#include
#include
#include
int main()
{
   char *string = "Pritesh Taral";
   printf("\nString before to strlwr : %s", string);
   strlwr(string);
   printf("\nString after strlwr : %s", string);
   return (0);
}

Output

String before to strlwr : Pritesh Taral
String after strlwr : pritesh taral

C Program to Convert String into Lowercase Using Library Function


#include
#include
#include
int main()
{
   char string[100];
   printf("Enter String : ");
   gets(string);
   strlwr(string);
   printf("\nString after strlwr : %s", string);
   return (0);
}

Output

Enter String : Pritesh Taral
String after strlwr : pritesh taral

No comments:

Post a Comment