Entri Populer

Selasa, 25 Januari 2011

C++ Programming -3 A

Click here for C++ PROGRAM
#include <iostream.h>
#include <iostream.h>
#include <conio.h>

void main()
{
clrscr();
int x,y,sum;
float average;
cout << "Enter 2 integers : " << endl;
cin>>x>>y;
sum=x+y;
average=sum/2;
cout << "The sum of " << x << " and " << y << " is " << sum << "." << endl;
cout << "The average of " << x <<  " and " << y << " is " << average << "." << endl;
getch();
}
This program takes in two integers x and y as a screen input from the user.
The sum and average of these two integers are calculated and outputted using the 'cout' command.

Tidak ada komentar:

Posting Komentar