Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. #include<string.h>
  4.  
  5. int main()
  6.  
  7. {
  8.  
  9. char str[20];
  10.  
  11. int i;
  12.  
  13. printf("Enter any string->");
  14.  
  15. scanf("%s",&str);
  16.  
  17. for(i=0;i<=strlen(str);i++){
  18.  
  19.  
  20. if(str[i]>=65&&str[i]<=90)
  21.  
  22. str[i]=str[i]+32;
  23.  
  24. }
  25.  
  26. printf("nThe string in lower case is->%s",str);
  27.  
  28. return 0;
  29.  
  30. }
  31.  
  32. #include <stdio.h>
  33. #include <ctype.h>
  34. #include <string.h>
  35. ...
  36. if ( fgets( str, sizeof str, stdin ) != NULL )
  37. {
  38. /**
  39. * chop off the newline if it's present
  40. */
  41. char *newline = strchr( str, 'n' );
  42. if ( newline )
  43. {
  44. *newline = 0;
  45. }
  46.  
  47. /**
  48. * Convert the string to lower case.
  49. */
  50. for ( int i = 0; str[i] != 0; i++ )
  51. str[i] = tolower( str[i] );
  52. }
  53.  
  54. void convertToUpperCase(char *sPtr)
  55. {
  56. while(*sPtr != '')
  57. {
  58. if (islower(*sPtr))
  59. *sPtr = toupper(*sPtr);
  60. }
  61. }
  62.  
  63. scanf("%s",&str);
  64.  
  65. scanf("%[^n]",str);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement