One foot equals 12 inches. Write a function that accepts a length written in feet as an argument and
returns this length written in inches. Write a second function that asks the user for a number of feet and
returns this value. Write a third function that accepts a number of inches and displays this to the screen
Use these three functions to write a program that asks the user for a number of feet and tells them the
corresponding number of inches.
Answers
Answered by
2
#include <stdio.h>
int main() {
// Declare Variables
int f,i = 0;
//Read Feet Value
printf("Enter Feet Value : ");
scanf("%d",&f);
//Converting into inches
i=f*12;
//Print Total Inches
printf("Total Inches : %d\n",i);
return 0;
}
Answered by
0
Given:
One foot equals 12 inches
To find:
Program
Solution:
#include <stdio.h>
Void inpfeet(){ //Read Feet Value
printf("Enter Feet Value : ");
scanf("%d",&f);
}
Void convert(){ //Converting into inches
i=f*12;
}
Void disp(){ //Print Total Inches
Printf(“the length in inches is %d”,i);
}
int main() {
// Declare Variables
int f,i = 0;
inpfeeet(); //calling functions
convert();
disp();
return 0; // return type of main
}
Similar questions