Exercise 1/ lab sheet 7
Wed Dec 07 2022 14:58:04 GMT+0000 (Coordinated Universal Time)
Saved by
@Mohamedshariif
//Write a function called aveTwo that will
//1- take two floating point numbers as input
//2- calculates the average of two numbers
//3- prints the result on the screen
//Hint: the function header will be
//void aveTwo(float n1,float n2)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void aveTwo(float number1,float number2);
int main() {
float number1,number2;
printf("please enter number 1: ");
scanf("%f",&number1);
printf("please enter number 2: ");
scanf("%f",&number2);
float ave = (number1+number2) / 2.0;
printf("the avrage of number1 and number2 is %f\n",(number1+number2)/2.0);
return 0;
}
content_copyCOPY
Comments