Posts

Showing posts with the label about c language

Switch case Statement in C language

Image
•Switch case statement: This control statement , which allows us to make a decision from the number of choice, is called a switch. with the help of switch case statement we may choose any number of decisions, or more correctly a switch-case default, since the combination of these three key words go together to make up the control statement. Syntax: switch (expression) {      case 1:      statement (Group 1)      case 2:      statement ( Group 2)      case 3:      statement ( Group 3)      default      statement ( Group 4) } The switch statement checks, whether an expression matches with number of integer or character constant. Example- For "if - else" #include<stdio.h> void main() { int age; printf ("Enter your age"); scanf("%d",&age); if (age>=18) printf("you can vote ") else  printf ("You c...