Write a program to Use of simple functions in C. Functions is a bunch of statements grouped together. A function is provided with zero or more arguments, and it executes the statements on it.
Example:
Input: a=3, b=4, c=6, d=5
Output: 6
C Program
#include <stdio.h>int max_of_four(int a, int b, int c, int d){if (a > b && a > c && a > d)return a;else if (b > a && b > c && b > d)return b;else if (c > a && c > b && c > d)return c;elsereturn d;}int main(){int a = 3, b = 4, c = 6, d = 5;int ans = max_of_four(a, b, c, d);printf("%d", ans);return 0;}
No comments:
Post a Comment