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



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

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

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

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

Post New Answer

More OOPS Interview Questions

What makes a language oop?

0 Answers  


why to use operator overloading

3 Answers  


What is the significance of classes in oop?

0 Answers  


What are properties in oop?

0 Answers  


3. Differentiate verification and validation.

1 Answers  






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.

4 Answers   NIIT, TCS,


tel me oops defination in single line

2 Answers  


#include <iostream> using namespace std; int main() { int a = 2; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][c[1][4]]; }

2 Answers   TCS, Wipro,


What are the components of marker interface?

0 Answers  


Can a destructor be called directly?

0 Answers  


what are the ways in which a constructors can be called?

2 Answers   TCS,


pointers are support in C#? if yes then how to use it?

8 Answers   Softvision Solution,


Categories