Average marks






Write a program to input name (as a single character) and marks of three tests of a student (all integers). Then calculate and print the name and average (integer) of all test marks.
All the test marks are integers and calculate average also as integer. That is you need to print the integer part of average only, neglect the decimal part.

#include<iostream>
using namespace std;

int main()
{
  int a,b,c;
  char letter;
  cin >> letter;
  cin >> a >> b >> c;
  int sum = a+b+c ;
  int avg = sum/3;
  cout << letter << endl;
  cout << avg <<endl;
 }


SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment