Saturday, September 6, 2014

BCA LECTURE-5 CASE CONTROL STRUCTURE

 Case Control Structures
switch case statements
switch (expression)
{
case val_1 : statements; break;
case val_2 : statements; break;
……………..
……………..
case val_n: statements; break;
default: statements;
}
          
1 ONE
2 TWO
3 THREE
4 FOUR

Example
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("\nEnter Any Number : ");
scanf("%d",&n);
switch(n)
{
  case 1 : printf("\nONE"); break;
  case 2 : printf("\nTWO"); break;
  case 3 : printf("\nTHREE"); break;
  case 4 : printf("\nFOUR"); break;
  case 5 : printf("\nFIVE"); break;
  case 6 : printf("\nSIX"); break;
  default : printf("\nInvalid");
}
getch();
}

No comments:

Post a Comment

JAC Board Computer || IIT 2025 || Introductory Information Technology || Class 10 || Practical Examination 2025

Marks Division HOE 30 Marks IT Application Report File 20 Marks Viva - Voce 10 Marks 1) Write an HTML code to generate a web p...