Skip to main content

Step by step descriptive logic to find total, average and percentage.

Step by step descriptive logic to find total, average and percentage.BY GOOGLE SEARCH

1) Input marks of five subjects. 
2) Store it in some variables say eng, phy, chem, math and comp.
3) Calculate sum of all subjects and store in total = eng + phy + chem + math + comp.
4) Divide sum of all subjects by total number of subject to find average i.e. 
5) average = total / 5.
Calculate percentage using percentage = (total / 500) * 100.
Finally, print resultant values total, average and percentage.
    Program 

/**
 * C program to calculate total, average and percentage of five subjects
 */

#include <stdio.h>

int main()
{
    float eng, phy, chem, math, comp; 
    float total, average, percentage;

    /* Input marks of all five subjects */
    printf("Enter marks of five subjects: \n");
    scanf("%f%f%f%f%f", &eng, &phy, &chem, &math, &comp);

    /* Calculate total, average and percentage */
    total = eng + phy + chem + math + comp;
    average = total / 5.0;
    percentage = (total / 500.0) * 100;

    /* Print all results */
    printf("Total marks = %.2f\n", total);
    printf("Average marks = %.2f\n", average);
    printf("Percentage = %.2f", percentage);

    return 0;
}

Comments

Popular posts from this blog

Classification of Networks Based on Geographical Classification

               ***Classification of Networks Based on Geographical Classification***                   In this section ,we will discuss the following categories of networks.                                                                                                                 PAN ...

IS THERE ANYTHING THROUGH WHICH WATER CANNOT PASS BUT AIR PASSES???

IS  THERE ANYTHING THROUGH WHICH WATER CANNOT PASS BUT AIR PASSES??? YES, there is a substance that allows to water vapour to pass but not air. Read carefully Teflon is a substance that allow to pass to water vapour but not to the air, both are same and also nearly about same in form i.e. gases form…                 Point is that if we want to pass small molecules from anything it is possible because of small pores, holes and gaps present between it. Because of that small holes molecules are passed out. Large things are not pass through small small holes. water permeable image But in this case both the constituents are in the same form but one cannot pass and another can be pass from it, but why now we explain it.                 By stretching the substance that from we want to pass water or air small pores are formed millions...

Simple java prime or not program

public class PrimeExample{     public static void main(String args[]){       int i,m=0,flag=0;         int n=3;//it is the number to be checked       m=n/2;         if(n==0||n==1){      System.out.println(n+" is not prime number");         }else{      for(i=2;i<=m;i++){           if(n%i==0){            System.out.println(n+" is not prime number");            flag=1;            break;           }          }          if(flag==0)  { System.out.println(n+" is prime number"); }     }//end of else   }     }