Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Specifer



Working with switch case



Comment



Iterative statement



" ; " after loop




Function_ area of a triangle




// AHF C PROGRAM SOLVING

//The problem are solving here using FUNCTION

#include<stdio.h> #include<math.h> #define pf printf //function declaration float triangle(int x, int y); int main() { int a,b; float result; pf("Enter the value of a and b: "); scanf("%d %d",&a,&b); //function call result=triangle(a,b); pf("\nThe area of the triangle is %.2f",result); return 0; } //function definition float triangle(int x, int y) //function header //function body { return (.5*x*y); //return answer }
OUTPUT:


© 2018 - All rights reserved