Home

A program to explain FUNCTION WITHOUT ARGUMENTS and WITHOUT RETURN VALUES

C Programming Language 075

Program

#include <stdio.h>

void triangle();

void main()
{
    triangle();
    printf("\n");
}

void triangle()
{
    float a, b, h;
    printf("Enter b, h: ");
    scanf("%f %f", &b, &h);

    a = 0.5 * b * h;
    printf("Area = %f", a);
}

Result

Enter b, h: 2 3
Area = 3.000000


Last Updated on

Next Post: Rules vs Guidelines →

Comments