can anyone explain why the output of this code is 110 ?

// Assignment 1-Body Mass Index Calculator

#include <iostream> //allows program to output data to the screen
 
using namespace std;

 //function main begins program execution
int main()
{
	int total=0;
	for (int number =2;number<=20;number+=2)
		total +=number;
	cout<<"Sum Is"<<total<<endl;
return 0 ;
}

Recommended Answers

All 5 Replies

Because 0+2+4+6+8+10+12+14+16+18+20 = 110?
What do you think the output should be.

i need help i wanna know how can i pass am array of objects to the constructor header & the .cpp implementation ? & prompt the user to enter the values to fill it ?
& how to pass it if it's array of int & its multi dimension ? thanks

any could help me ??
thanks

commented: Very rude. Don't hijack someone else's thread -2

any could help me ??
thanks

How about... You start your own thread?

OK
: )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.