I have compiled other programs before but, for some reason, I can't work anymore. I have a mac Here's my code. Its purpose is to take three numbers and find the average.
#include <stdio.h>
int main(){
int first;
int second;
int third;
float average=0.0;
printf ("This program will find the average of 3 numbers.\n");
delay(1000);
printf ("Type the first number.\n");
scanf ("%d", &first);
printf ("Type the second number.\n");
scanf ("%d", &second);
printf ("Type the third number.\n");
scanf ("%d", &third);
average = (first+second+third)/2.0;
printf ("The average of %d, %d, and %d is %.3f\n", first, second, third, average);
return (0);
}
These are the steps I have taken. I put average.c and average.h on the desktop. I open terminal and type
cd Desktop
gcc /Users/reneelion/Desktop/average.c average
Then it says:
average: No such file or directory.
I am a beginner at coding and don't know what to do.