What's wrong with this program??

#include <stdio.h>
int main void
{
int a,b,c,d;
float avg;
printf("Please insert score test 1: ");
scanf("%d",&a);
printf("Please insert score test 2: ");
scanf("%d",&b);
printf("Please insert score test 3: ");
scanf("%d",&c);
avg=(a+b+c)/3;
}
{
if (avg>=90);
printf("Your Grade is A");
else if (avg<90);
   if (c>=90);
   printf("Your Grade is A");
   else
   printf("Your Grade is B");
else if(avg<70);
printf("Your Grade is C");
else if(avg<50);
printf("Your Grade is D");
}

i want separate that function
1 for read score
2 for determine average
3 print result

can you teach me??

Now your grade in C++ language is Z...
Better take your text-book and read about function definition syntax.
When you write a valid main function header, come again...

Again, code tags are important:

[code]

// paste code here

[/code]

or

[code]

// paste code here

[/code]

You already have other threads on this topic. Please don't start new ones. Keep one of them open and mark the others solved so people know where to post.

#include <stdio.h>
int main void
{
int a,b,c,d;
float avg;
printf("Please insert score test 1: ");
scanf("%d",&a);
printf("Please insert score test 2: ");
scanf("%d",&b);
printf("Please insert score test 3: ");
scanf("%d",&c);
avg=(a+b+c)/3;
}
{
if (avg>=90);
printf("Your Grade is A");
else if (avg<90);
if (c>=90);
printf("Your Grade is A");
else
printf("Your Grade is B");
else if(avg<70);
printf("Your Grade is C");
else if(avg<50);
printf("Your Grade is D");
}

Your last attempt was better than this one. You are ending the main function at line 13 and attempting to start a function on line 14, but you need to say what that function is. Stick a function declaration before main, with a semicolon at the end, then copy that same function declaration where line 14 is, but take off that semicolon. An example:

int func1 ();
bool func2 ();
void func3 ();

int main ()
{
    // do stuff
    return 0;
}

int func1 ()
{
    // do stuff
}

bool func2 ()
{
    // do stuff
}

void func3 ()
{
   // do stuff
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.