How to use return statement in C language

Return Statement

On this page

Return Statement

Program to use Return Statement in C Language

#include <stdio.h>
void selection(int age, float ht);
int main()
{
    int age;
    float ht;
    printf("Enter age and Height : ");
    scanf("%d%f", &age, &ht);
    selection(age, ht);
    return 0;
}
void selection(int age, float ht)
{
    if (age > 25)
    {
        printf("Age should be less than 25\n");
        return;
    }
    if (ht < 5)
    {
        printf("Height should be more than 5\n");
        return;
    }
    printf("selected\n");
}

Output

Enter age and Height : 24
5
selected