Home » , » Basic C Programming Practice - Practice 6

Basic C Programming Practice - Practice 6

Written By Unknown on Thursday, October 10, 2013 | 11:35 PM

=> Write a program in C to convert lower case letters to upper case letters ?




Solution :

#include<stdio.h>
#include<conio.h>

int main()

{
     char ch;

     scanf("%c", &ch);

     if(ch>='a' && ch <='z') 
     

     printf("%c",ch-32); 
     
     else 
     

     printf("%c",ch);
     
     getch(); 

} 

Program Analysis :
Here ch is a character type variable,we use % c to get input character from user or terminal.-32 works like a converter to convert lowercase letter to uppercase.

The program says,If any lowercase number inputted by user then convert it to uppercase number otherwise print the number what user inputted because it is already uppercase character.

Share this article :

Post a Comment

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Learn Programming - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger| Distributed by Rocking Templates