C Language

June 7, 2023

How to use return statement in C language

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

by : Ajaj Khan

Quick Summary:

इस program मैं अगर 25 से ज्यादा age है तो और height मैं 5 से कम है तो selected नही होगा
अगर age 20 है और height 6 है तो selected