Answer to Question #291309 in C++ for ali

Question #291309

Write a program that iterates through the odd numbers less than 30, and outputs the square of each number. 


1
Expert's answer
2022-01-28T12:52:52-0500
#include <iostream>
#include<math.h>


using namespace std;


//The start point of the program
int main(){
	cout<<"Odd number\tSquare\n";	
	for(int i=0;i<=30;i++){
		if(i%2!=0){
			cout<<i<<"\t\t"<<(i*i)<<"\n";	
		}
	}
	system("pause");
	return 0;
}

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