I have asked to find the Root means Square of the given series of numbers. -99 to exit from the program.
But when I execute the program every time I get unbelievable answers like 57, 70.
This is the program.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int no;
int count=0;
int sum=0;
int Sqno=0;
while(no != -99)
{
cout<<"Enter no\n";
cin>>no;
You're using no while(no != -99) before you define it.
BTW, if you select your code and then click the <> button on the right it will format it making it easier to read. Indenting properly is nice too. It's just cosmetic but it makes it easier to get help when you have more complex code. ;-)