Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

little doubt in C ?progmmers out there help me?

i have written a program in c to find out the percentage well every thing gone wright but i want to add IF function i want to get the output as good if the percentage is above 70

and bad if the percentage is below 50

herez the program

main()

{

int envi science,hindi,english,maths,science,social,percentage,average,good;

printf("enter the marks in envi science: ");

scanf("%d",&envi science);

printf("enter the marks in hindi: ");

scanf("%d",&hindi);

printf("enter the marks in english: ");

scanf("%d",&english);

printf("enter the marks in maths: ");

scanf("%d",&maths);

printf("enter the marks in science: ");

scanf("%d",&science);

printf("enter the marks in social: ");

scanf("%d",&social);

percentage=(envi science+hindi+english+maths+science+social)/6;

printf("the percentage is %d\n",percentage);

if("percentage<50",&average);

if("percentage>70",&good);

printf(" a prrrrrrrrroooooogggggggrrrrrrrrraaaaaaaammmmmmmm written by sanjay\n");

getch();

}

HOW CAN I MODIFY THIS PROGRAM TO GET THAT TYPE OF OUTPUT

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    main()

    {

    int envi_science,hindi,english,maths,science,soci...

    printf("enter the marks in envi science: ");

    scanf("%d",&envi_science);

    printf("enter the marks in hindi: ");

    scanf("%d",&hindi);

    printf("enter the marks in english: ");

    scanf("%d",&english);

    printf("enter the marks in maths: ");

    scanf("%d",&maths);

    printf("enter the marks in science: ");

    scanf("%d",&science);

    printf("enter the marks in social: ");

    scanf("%d",&social);

    percentage=(envi_science+hindi+english+maths+science+soci...)

    /numberoflessons;

    printf("the percentage is %d\n",percentage);

    if(percentage<50)

    printf("average\n");

    else if(percentage>70)

    printf("good\n");

    printf(" a prrrrrrrrroooooogggggggrrrrrrrrraaaaaaaa... written by sanjay\n");

    getch();

    }

    hope it helps

    Source(s): my head
  • 1 decade ago

    main()

    {

    int envi science,hindi,english,maths,science,soci...

    printf("enter the marks in envi science: ");

    scanf("%d",&envi science);

    printf("enter the marks in hindi: ");

    scanf("%d",&hindi);

    printf("enter the marks in english: ");

    scanf("%d",&english);

    printf("enter the marks in maths: ");

    scanf("%d",&maths);

    printf("enter the marks in science: ");

    scanf("%d",&science);

    printf("enter the marks in social: ");

    scanf("%d",&social);

    percentage=(envi science+hindi+english+maths+science+soci...

    printf("the percentage is %d\n",percentage);

    if("percentage<50")

    {

    printf("%d",average);

    }

    else

    if(percentage>70)

    {

    printf("%d",good);

    }

    printf(" a prrrrrrrrroooooogggggggrrrrrrrrraaaaaaaa... written by sanjay\n");

    getch();

    }

  • Anonymous
    1 decade ago

    expert helps for project,programming,webdesign

    http://experthelps.info/

Still have questions? Get your answers by asking now.