0
Can someone explain me how the output is coming to 1890?
#include<iostream> using namespace std; float value = 900; void local (int T) { int result = 0; for ( int I=0; I<T; I++) result+=I; cout << value + result ; } int main() { local(45); return 0; }
2 Respostas
+ 1
Thanks for answering, Not getting how is 990 coming ( I am new to functions) all I understood is float value = 900 is global my question is the loop
+ 1
Dipanjan Basu , first the loop calculates the following sum 0+1+2+3+...+44 => 990. Next adding 900 and display it 990 + 900 => 1890.