write a c program to enter 10 people and find the number of people having age between 15 to 20.


QUESTION:- write a c program to enter 10 people and find the number of people having age between 15 to 20. 




#include <stdio.h>

#include <conio.h>

void main()

{

    int arr[10], count = 0;

    for (int i = 1i <= 10i++)
    {

        printf("enter a age of %d person: "i);

        scanf("%d", &arr[i]);
    }

    for (int i = 0i < 10i++)

    {

        if (arr[i] >= 15 && arr[i] <= 20)
        {

            count++;
        }
    }

    printf("There are %d number of people age between 15 to 20."count);

    getch();
}

 

OUTPUT

enter an age of 1 people: 7

enter an age of 2 people: 16

enter an age of 3 people: 10

enter an age of 4 people: 15

enter an age of 5 people: 18

enter an age of 5people: 17

enter an age of 7 people: 19

enter an age of 8 people: 40

enter an age of 9 people: 30

enter an age of 10 people: 20


Follow our page for regular updates.

0 Comments