Program for average of two numbers


  # include<iostream.h>
   int main( )
  {
         float no1, no2, sum, avg ;                       // variable declaration
         cout<< "Enter two numbers : ";              //promt
    // Reads numbers from keyboard
         cin >> no1; 
         cin >> no2;
          sum = no1 + no2;
          avg  = sum / 2 ;
          // Display output on screen
          cout << "Sum = " <<sum << "\n";
          cout << "Average = " <<avg << "\n";

          return 0 ;
   }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|