Sunday 8 April 2012

31)Write a Program Which Reads Three Student Marks in a Test and Then Print Their Average

#include<conio.h>
#include<iostream.h>


void main()
{
   clrscr();
   int num1,num2,num3;
   float average;
   cout<<"Enter Three student marks.\n" ;
   cin>>num1>>num2>>num3;
   average=(num1+num2+num3)/3;
   cout<<"Average of  " <<num1 <<" "<<num2<<" "<<num3<<"is " <<average;
}

No comments:

Post a Comment

Write a program which reads a set of integers into an integer array and then prints "YES"if all of them are same otherwise print "NO".

#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...