Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char str[20];
- int i;
- printf("Enter any string->");
- scanf("%s",&str);
- for(i=0;i<=strlen(str);i++){
- if(str[i]>=65&&str[i]<=90)
- str[i]=str[i]+32;
- }
- printf("nThe string in lower case is->%s",str);
- return 0;
- }
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- ...
- if ( fgets( str, sizeof str, stdin ) != NULL )
- {
- /**
- * chop off the newline if it's present
- */
- char *newline = strchr( str, 'n' );
- if ( newline )
- {
- *newline = 0;
- }
- /**
- * Convert the string to lower case.
- */
- for ( int i = 0; str[i] != 0; i++ )
- str[i] = tolower( str[i] );
- }
- void convertToUpperCase(char *sPtr)
- {
- while(*sPtr != '