Question #333375

write c++ code to get following output 0,1,4,9,16,25 (use array)

Expert's answer

#include <iostream>

using namespace std;

int main()
{
	int arr[6] = { 0,1,2,3,4,5 };
	for (int i = 0; i < 6; i++)
	{
		if(i!=5)
			cout << arr[i] * arr[i] << ",";
		else
			cout << arr[i] * arr[i];
	}	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS