First C language code

Source: Internet
Author: User

#include <stdio.h>
void Main ()
{
int g1,g2,g3,r1,r2,r3,n;
int m=0;
Float Ave;
int grade[3][3]; Let's say there are three of students
while (m<=2)
{
printf ("Please enter the school number as");
printf ("%d students ' scores (subjects in front) \ n", m);
scanf ("%d%d%d", &g1,&g2,&g3);
if (0<=g1&&g1<=100&&0<=g2&&g2<=100&&0<=g3&&g3<=100)
{
GRADE[M][3]=G1;
GRADE[M][3]=G2;
GRADE[M][3]=G3;
m++;
}
Else
{
printf ("Input error, please re-enter \ n");
}

}
end:printf ("Please enter the number of the study to be queried \ n");
scanf ("%d", &n);
if (n>=0&&n<=2)
{
R1=GRADE[N][3];
R2=GRADE[N][3];
R3=GRADE[N][3];
Ave= (R1+R2+R3)/3;
if (r1+r2+r3>270)
printf ("Enter the number according to the requirements, average divided into%f\n", ave);
else if (r1>95&&r2>95&&r3>75)
printf ("Enter the number according to the requirements, average divided into%f\n", ave);
else if (r1=100&&r2>=80&&r3>=80)
printf ("Enter the number according to the requirements, average divided into%f\n", ave);
else if (r2=100&&r1>=80&&r3>=80)
printf ("Enter the number according to the requirements, average divided into%f\n", ave);
Else
printf ("The input number does not meet the requirements \ n");
Goto end;
}
Else
{
printf ("Input error, please re-enter \ n");
Goto end;
}

}

In fact, the fourth day of learning C has written most

The fifth day spent almost an afternoon perfecting it.

The original request is

One of the two doors subjects, enter the study number,

1: Achieve a total score greater than 270,

2, two doors subjects is greater than 95, the other door is not less than 75,

3, there is a door subjects 100, the other not less than 80 points,

Judge a number that satisfies one of three conditions and outputs an average of

First C language code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.