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

Program to find Volume of given box in java

class volume { public static void main (String args []) { int l=5,b=6,h=10; int volume; volume=l*b*h; System.out.println (" vol...