Sunday, 17 June 2018

Program in C to change its case ( upper to lower and lower to upper) as input from the user using function

/* function prototype */
# include <stdio.h>
char change-case (char) ;
void main ()
{
char ch,c ;
clrscr () ;
printf ("\n Enter a character:") ;
scanf ("%C",  & ch) ;
c = change-case (ch) ;
printf ("%c", c) ;
}
char change-case (char ch)
{
if ( (ch>97) && (ch<122))
{
ch = ch-32 ;
return ch ;
}
else
{
ch = ch+32 ;
return ch ;
}
}

No comments:

Post a Comment

Featured post

Kalgudi Interview Round!!

Those who cleared the second round of kalgudi got an email from exceller to complete their Kalgudi Interview Round. So here we will discuss ...