Write a program in c++ to read two floating point numbers
and find their sum and average.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / mahmali
#include<iostream.h>
#include<conio.h>
main()
{
float a,b,sum,avg;
cout<<"Enter values of a and b";
cin>>a>>b;
sum=a+b;
avg=sum/2;
cout<<"sum of the no.="<<sum;
cout<<"avg of the no.="<<avg;
getch();
}
| Is This Answer Correct ? | 2 Yes | 5 No |
What is encapsulation example?
pointers are support in C#? if yes then how to use it?
8 Answers Softvision Solution,
Advantage and disadvantage of routing in telecom sector
Why multiple inheritance is not allowed?
What is polymorphism in oops with example?
Does c++ support multilevel and multiple inheritance?
what is an instance of a class
What is a class in oop?
What is sub classing in c++?
What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?
c++ provides classes...and classes do what we want but why then strcut are used...if we say data hiding... it is also provided by c++ in structs then why to prefer clasess
Why is polymorphism important in oop?