Thursday, 27 August 2015

Write a C Program To Write function that will scan a character string passed as an argument and convert all lower-case character into their upper-case equivalent

Write a C Program To Write function that will scan a character string passed as an argument and convert all lower-case character into their upper-case equivalent
1:  #include<stdio.h>  
2:  #include<conio.h>  
3:  void upper(char[]);  
4:  int main()  
5:  {  
6:        char str[20];  
7:        clrscr();  
8:        printf("Enter string : ");  
9:        gets(str);  
10:        upper(str);  
11:        getch();  
12:        return 0;  
13:  }  
14:  void upper(char str[20])  
15:  {  
16:        int i;  
17:        printf("%s in upper case is ",str);  
18:        for(i=0;str[i];i++)  
19:        {  
20:              if(str[i]>96 && str[i]<123)  
21:                    str[i]-=32;  
22:        }  
23:        printf("%s",str);  
24:  }  

No comments:

Post a Comment