Skip to main content

Finding Average and Grade of Five numbers Coding in C language

Finding Average and Grade of Five numbers Coding in C language



#include<stdio.h>
void main()
{
    int a,b,c,d,e,f;
    float g;
    printf("Please enter any five numbers");
    scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
    f=a+b+c+d+e;
    printf("%d",f);
    printf("\nThis is average of all numbers");
    g=f/5.0;
    printf("\n%.2f",g);
    printf("\nThis is grade of average");

        if(g>90)
        {
            printf("\nA");
        }
        else if(g>75)
        {
            printf("\nB");
        }
        else if(g>60)
        {
             printf("\nC");
        }
        else if(g>50)
        {
             printf("\nD");
        }
        else if(g>40)
        {
             printf("\nE");
        }
        else
        {
              printf("\nF");
        }
}

Comments

Popular posts from this blog

Prime Number C language Code | Niks banna

Prime Number C language Code  C language code runs on some text editiors who compile it and run it. here is the code copy it all paste on your .c extension file #include<stdio.h> void main() {     int i,n,t=0; scanf("%d",&n); for(i=2;i<n;i++) {     if(n%i==0)     {         printf("not a prime number");         t=1;         break;     } }     if(t==0)     {         printf("Prime number");     } } THANKS FOR READING FOLLOW ME  

Find Maximum Value C language Code

Find Maximum Value C language Code #include <stdio.h> int main() {   int array[100], maximum, size, c, location = 1;   printf("Enter the number of elements in array\n");   scanf("%d", &size);   printf("Enter %d integers\n", size);   for (c = 0; c < size; c++)     scanf("%d", &array[c]);   maximum = array[0];   for (c = 1; c < size; c++)   {     if (array[c] > maximum)     {        maximum  = array[c];        location = c+1;     }   }   printf("Maximum element is present at location %d and it's value is %d.\n", location, maximum);   return 0; } THANKS FOR READING  FOLLOW ME