convert the string to lower case in C Programming

Given below is a requirement and program which is jumbled across, re-arrange the shuffled code segments in the correct order, to satisfy the requirement.

Lower Case
Write a program to convert the string to lower case.

Input and Output Format:
Input consists of a string. Assume that the input string consists of only letters and the maximum length of the string is 20.
Refer sample input and output for formatting specifications.
All text in bold corresponds to input and the rest corresponds to output.

Sample Input and Output:
Enter the input string
AmphiSoft
The output string is amphisoft

Image result for lower case string c

Program

  • #include stdio . h
  • #include string . h
  • int main()
  • {
  • int i;
  • char a[20];
  • for(i=0;i<=strlen(a);i++)
  • printf("Enter the input string\n");
  • scanf("%s",a);
  • if(a[i]>=65 && a[i]<=90)
  • {
  • printf("The output string is %s\n",a);
  • a[i]=a[i]+32;
  • }
  • return 0;
  • }

No comments