Answer to Question #333375 in C++ for brwarahim

Question #333375

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

1
Expert's answer
2022-04-25T13:37:17-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS