Pages

Sunday, October 7, 2012

How can i convert a line of upper case to lower case

 #A program that convert a line to lower case

 



   1.  #include<stdio.h> 
2.  #include<conio.h> 
3.  #include<string.h> 
4.   
5.  void main() 
6.  { 
7.     char st[100]; 
8.     int i,l; 
9.   
10.    clrscr(); 
11.    printf("Enter any line: "); 
12.    gets(st); 
13.  
14.    l=strlen(st); 
15.    for (i=0; i<l; i++) 
16.    if (st[i]>='A' && st[i]<='Z') 
17.    printf("%c",st[i]+32); 
18.    else 
19.    printf("%c",st[i]); 
20.    getch(); 
21. } 

No comments:

Post a Comment