Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete C++ program using while loops that prints the squares of the in

ID: 3563979 • Letter: W

Question

Write a complete C++ program using while loops that prints the squares of the integers from the 1 to the number given by user to the console window, separated by spaces.

Outline:

a) Ask a user for a positive number greater than 1

b) If input is invalid - ask again until the user gives you valid input

c) After that program prints to the console the squares of the integers from 1 to the number given by the     user (including)

Examples:

#1. Input positive integer greater than 1: 1

      Try again: -

Explanation / Answer

your answer is here if you have any issue than plz mail me ask me i'll give you detail explanation thankyou plz rate broo

#include <iostream>
using namespace std;

int main()
{
   int no;
   cout<<"Enter the input greater than 1 : ";
   cin>>no;
   while(no<1)
   {
       cout<<"Enter the again input : ";
       cin>>no;
   }
   for(int i=1;i<=no;i++)
   {
       cout<<i*i<<" ";
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote