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 |
create a class complex having real and imaginary part of a complex no. as a data member. overload the binary operators(+,- and *) to perform the operations on complex no. objects. overload binary operator using friend function.
2 Answers CTS, Delhi University,
How can i write a code in c# to take a number from the user and then find all the prime numbers till the number entered by the user.
how to get the oracle certification? send me the answer
what is single inheritance?
What does the code "cout<<(0==0);" print? 1) 0 2) 1 3) Compiler error: Lvalue required
What is abstraction encapsulation?
What is persistence in oop?
Whats is abstraction in oops?
what is ltti
define oops with class and object
write a short note on Overloading of Binary Operator?
When not to use object oriented programming?