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 the realstic modeling?
how do u initialize the constant variables
is there any choice in opting subjects like 4 out of 7
What is object in oop with example?
What are oops methods?
What is multiple inheritance?
Which is the best institute in hyderabad for C/C++ and it also has fast track course structure.
What is operator overloading? Give Example
11 Answers CTS, IBM, TCS,
What is an advantage of polymorphism?
What is interface? When and where is it used?
In which Scenario you will go for Interface or Abstract Class?
1 Answers InfoAxon Technologies,
When is an object created and what is its lifetime?