johnmarkthegreat

Sample Program using Function 2

Mar 5th, 2024
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | Source Code | 0 0
  1. #include <stdio.h>
  2.  
  3. float convertToCm(float feet, float inches);
  4.  
  5. int main() {
  6. float x, y;
  7. scanf("%f %f", &x, &y);
  8. printf("%.2f", convertToCm(x, y));
  9.  
  10. return 0;
  11. }
  12.  
  13. float convertToCm(float feet, float inches) {
  14. feet *= 30.48;
  15. inches *= 2.54;
  16. return feet + inches;
  17. }
Tags: CSIT 112
Advertisement
Add Comment
Please, Sign In to add comment