returntype FunctionName(datatype args1,datatype args2,...) { Statements --------------- return value ; }
#include⁢stdio.h> int volume(int l,int b,int h) { int v; v=l*b*h; return v; } main() { printf("volume is %d",volume(5,2,3)); }
Volume is 30
#include⁢stdio.h> float interest(int p,float r,int n) { float si; si=p*r*n/100; return si; } main() { printf("Simple interest %f",interest(2500,12.25,3)); }
Simple Interest is 918.750000
#include⁢stdio.h> float circumference(int r) { float c; c=2*3.14*r; return c; } main() { printf("circumference is %f\n",circumference(2)); }
Circumference is 12.560000
#include⁢stdio.h> int sum(int n) { int i,s=0; for(i=1;i<=n;i++) s=s+i; return s; } main() { printf("sum is %d\n",sum(2)); }
Sum is 3
#include⁢stdio.h> int max(int a,int b) { if(a>b) return a; else return b; } main() { int z; z=max(4117,33451); printf("Greatest no. is %d",z); }
Greatest no. is 33451
#include<stdio.h> float interest(int ,float ,int); main() { float z; z=interest(5000,10.25,3); printf("Simple intrest is %f",z); } float interest(int p,float r,int n) { float si; si = p * r * n / 100; return si; }
Simple intrest is 1537.500000