Decision Statements 117
clrscr ()»
printf (" Enter Any ASCII Number: ")i
scanf ("%d",&ci);
clrscii);
switch(i)
{
case 'A':
printfi" Capital An");
break;
case'B':
prmtf(Capital B ");
break;
case C’:
printfi"Capital Cn");
break;
default
if(i>47&c& i<58)
printf (n Digit:[ %c ]”ri);
else if(i>=58b& i<=64)
printf(''nSymbol :[ %c]",i);
else if(i>64&8c i<91)
printf ("nCapital:[ %c]u,i);
else if(i>96 && i<123)
printf (un Small :[%c],i);
else
printf (“n Invalid Choice"4);
getcheO;
)
I
QUTEUT;
Enter Any ASCII Number: 65
Capital A
Explanation An ASCII number is entered. In the outer switch if its ASCII value is equivalent to 'A ',
* B' and ' C then relevant message is displayed. If the ASCII values are other than these three Values
then inner switch statement is used to determine it's equivalent ASCII symbols. The symbols may be
any character including special symbols and digits. If we enter 65,
Capital A is displayed.
SUMMARY
The reader is made aware of the decision-making statements such as i f and the i f - e l s e statements
in the C programming. Also multiway decision statement swi tc h () c a s e is also discussed. How
n este d if. .e ls e and sw itch () case statements are to be used in programs are also illustrated in a
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.10.32