Shopping In MUMBAI

Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top. Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.

Monday, December 29, 2008

Reverse String program using inbuilt functions

Write a c program to input a string from the user. Use appropriate built-in
string functions to find the length of the string, copy 1 string to another,
convert to uppercase, convert to lowercase, string comparison, string
comparison irrespective of case, comparison of n characters in 2 strings, string
concatenation, concatenation of ‘n’ of characters, reverse a string

#include
#include
#include
void main()
{
int l,comp,cmp;
char str[10], s1[10], s2[10], cat[20];
clrscr();
printf("Enter 1st String : ");
gets(str);
l=strlen(str);
printf("\nThe length of the String : %d",l);
strupr(str);
printf("\nIn UPPERCASE : %s",str);
strlwr(str);
printf("\nIn lowercase : %s",str);
strrev(str);
printf("\nIn Reverse : %s",str);
printf("\n\nEnter two strings : ");
scanf("%s %s",&s1,&s2);
cmp=strcmp(s1,s2);
if(cmp==0)
printf("\nStrings are equal");
else
printf("\nStrings are not equal");
strcat(s1,s2);
printf("\n\nString Concatenation : %s",s1);
strcpy(s1,s2);
printf("\nString2 copied into String1 : %s",s1);
getch();

}


/*Output
Enter 1st String : yahoo

The length of the String : 5
In UPPERCASE : YAHOO
In lowercase : yahoo
In Reverse : oohay

Enter two strings : yahoo
yahoo

Strings are equal

String Concatenation : yahooyahoo
String2 copied into String1 : yahoo

*/

Reverse String program using inbuilt functionsSocialTwist Tell-a-Friend

0 comments:

SUPPORT THIS BLOG