WHAT'S NEW?
Loading...

Conditional Decision


/*C Program to give a conditional decision*/
#include<stdio.h>

void main() {
    int cnt = 0, a = 0, b = 0, c = 0, age;
    for (cnt = 0; cnt < 15; cnt++) {
        printf("Enter the age: ");
        scanf("%d", &age);
        if (age <= 15)
            a++;
        else if (age <= 17)
            b++;
        else
            c++;
    }
    printf("\nStill a baby= %d", a);
    printf("\nAttending school= %d", b);
    printf("\nAdult life= %d", c);
}

1 comment: Leave Your Comments

  1. The decision making statements in C language are used to perform operations on the basis of condition and when program encounters the situation to choose a particular statement among many statements.
    Decision making statements lets you evaluate one or more conditions and then take decision whether to execute a set of statements or not. C language support multiple decision making statements like If statement, If else statement, Switch case statement, if else ladder etc.

    ReplyDelete