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

C++ Write a program to perform following tasks: With a while loop statement to a

ID: 3697793 • Letter: C

Question

C++

Write a program to perform following tasks: With a while loop statement to add squares of all the even numbers from 11 to 111 and display the sum. With a while loop statement to display the all the products of 5 Times a with a from 10 to 52 and 6 products in a row. With a while loop statement to display the squares of all numbers from 1 to 50 in a descending order with 10 numbers in a row. First ask a user how many scores that he/she is going to enter. Then, according to the user input, with a while loop statement to allow the user to enter the scores, add them up, find the minimum and maximum scores, and display the average, minimum and maximum scores. Your output screen should look like following: How many scores do you want to enter? 5 Please enter the scores: 87 90 76 88 92 The average score is 86.6 The minimum score is 76 The maximum score is 92

Explanation / Answer

1)

#include <iostream>
using namespace std;

int main() {
   // your code goes here
   int i=111,sum=0;;
   while(i>=11)
   {
   if(i%2==1)i--;
   sum += i*i;
   i-=2;
   }
   cout<<sum<<endl;
   return 0;
}

2)

#include <iostream>
using namespace std;

int main() {
   // your code goes here
   int i=10,j=1;
   while(i<=52)
   {
   cout<<5*i<<' ';
   if(j%6==0)cout<<endl;
   j++;
   i++;
   }
   return 0;
}

3)

#include <iostream>
using namespace std;

int main() {
   // your code goes here
   int i=50,j=1;
   while(i>0)
   {
   cout<<i*i<<' ';
   if(j%10==0)cout<<endl;
   j++;
   i--;
   }
   return 0;
}

4)

#include <iostream>
using namespace std;

int main() {
   // your code goes here
   int num,count;
   cout<<"Enter the number of scores:";
   cin>>num;
   count=num;
   if(num<=0)return 0;
   int temp;
   int min,max,sum=0;
   cin>>temp;
   num--;
   min=temp;
   max=temp;
   sum=temp;
   while(num--)
   {
   cin>>temp;
   if(temp<min)min=temp;
   if(temp>max)max=temp;
   sum+=temp;
   }
   cout<<"The maximum number is "<<max<<endl;
   cout<<"The minimum number is "<<min<<endl;
   cout<<"The average of all numbers is "<<sum*1.0/count<<endl;
   return 0;
}

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