Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to find average of 5 subjects

Posted By: Dominic Brown     Category: C Programming     Views: 29982

Write a program to find average of 5 subjects

Code for Program to find average of 5 subjects in C Programming

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
        int s1,s2,s3,s4,s5,sum;
        float avg;
        clrscr();
        printf("\n Enter Subject 1 Marks : ");
        scanf("%d",&s1);
        printf("\n Enter Subject 2 Marks : ");
        scanf("%d",&s2);
        printf("\n Enter Subject 3 Marks : ");
        scanf("%d",&s3);
        printf("\n Enter Subject 4 Marks : ");
        scanf("%d",&s4);
        printf("\n Enter Subject 5 Marks : ");
        scanf("%d",&s5);

        sum = s1+s2+s3+s4+s5;
        printf("\n\n THE SUMATION IS %d ",sum);
        avg = sum/5;
        printf("\n\n THE AVERAGE IS %.2f",avg);
        getch();
    }

******************OUTPUT****************************************


 Enter Subject 1 Marks : 41

 Enter Subject 2 Marks : 58

 Enter Subject 3 Marks : 60

 Enter Subject 4 Marks : 70

 Enter Subject 5 Marks : 60

 THE SUMATION IS 289

 THE AVERAGE IS 57.00


****************************************************************
  
Share: 


Didn't find what you were looking for? Find more on Program to find average of 5 subjects Or get search suggestion and latest updates.

Dominic Brown
Dominic Brown author of Program to find average of 5 subjects is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!