Write a program in c++ to read two floating point numbers
and find their sum and average.

Answer Posted / kiranlivz

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a,b,sum,avg;
cout<<"Enter 2 digits"<<endl;
cin>>a>>b;
cout<<"the 2 digits are:"<< " ";
cout<<a<<" "<<b<<;
sum=a+b;
avg=(a+b)/2;
cout<<"sum of the no."<<" ";
cout<<sum<<endl;
cout<<"avg of the no."<<" ";
cout<<avg;
getch();
}

Is This Answer Correct ?    15 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the concepts involved in Object Oriented programming.

635


What is the real time example of encapsulation?

595


just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.

6485


Why multiple inheritance is not possible?

598


What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?

1652






what are the different types of qualifier in java?

1842


What is polymorphism what are the different types of polymorphism?

566


Which is better struts or spring?

620


How to improve object oriented design skills?

569


What is methods in oop?

542


What is abstract class in oop?

532


What is the highest level of cohesion?

579


What are two types of polymorphism?

611


What is cohesion in oop?

624


What does and I oop and sksksk mean?

650