Advertisement
math230

Basic Structure of C Code

Jun 25th, 2020
1,432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<stdlib.h>
  4. #include<math.h>
  5.  
  6. float myAvg(float num1, float num2); //func proto
  7.  
  8. int main()
  9. {
  10.     float a=3.1, b=3.5;
  11.     printf("The avg is %f", myAvg(a,b) );
  12.     return 0;
  13. }
  14.  
  15. float myAvg(float num1, float num2)
  16. {
  17.     float answer;
  18.     answer=(num1 + num2)/2;
  19.     return answer;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement