******************************************************************************************
Please Upvote the answer as it matters to me a lot :)
*****************************************************************************************
As per Chegg expert answering guidelines, Experts are supposed to
answer only a certain number of questions/sub-parts in a post.
Please raise the remaining as a new question as per Chegg
guidelines.
******************************************************************************************
#include <iostream>
using namespace std;
int main() {
int n ;
do{
cout<<"Enter an odd integer between 10 and 20: ";
cin>>n;
}while((n>20)&&(n<10));
char a[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if((i==0)||(j==0)||(i==(n-1))||(j==(n-1)))a[i][j]='X';
else if(i==j)
{
a[i][j]='X';
}
else if ((i+j)==(n-1))
{
a[i][j]='X';
}
else
{
a[i][j]='-';
}
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
![C++14 14 Shortcuts S Reset Copy for(int j=0; j<n; j++) if((i==0)||(j==0)||(i==(n-1))||(j==(n-1)))a[i]: else if(i==j) 15 - a[i](http://img.homeworklib.com/questions/e9903ed0-b8c4-11eb-a09c-6dd49556d995.png?x-oss-process=image/resize,w_560)
Nested loops c++ nested loops 1. Request an odd integer value between 10 and 20. Input...
Request an integer n from the console. Write a function that accepts n as input and outputs the multiplication table of n from 1 to n to the console. Example Output (input in bold italics) Enter an integer: 9 1 * 9 = 9 2 * 9 = 18 3 * 9 = 27 4 * 9 = 36 5 * 9 = 45 6 * 9 = 54 7 * 9 = 63 8 * 9 = 72 9...
please use c++ language 1. Request three different integers from the console. a) Write a swap function that swaps two integer values. b) Write a sort function which accepts three integers as input then sorts them from largest to smallest using the swap function. c) Output the integers before and after sorting. Example 1 Output (input in bold italics) Enter three different integers: 3 2 4 3 2 4 4 3 2 Example 2 Output (input in bold italics) Enter...
1. Request a 3-digit integer from the console. Use division and modulo operations to extract each digit in reverse order. For each digit, determine if it is a factor of the original integer. Example Output (input in bold italics) Enter a 3-digit integer: 543 Is 3 a factor of 543? 1 Is 4 a factor of 543? 0 Is 5 a factor of 543? 0 c++ language
LABORATORY EXERCISES: Using nested for loops, write a java program to print the pattern as shown in the sample output. The program does the following: It prompts the user to enter an integer between 1 and 10. It outputs the pattern shown in the sample output based on the user input. Sample output: Enter an integer from 1 to 10: 8 The pattern is: x x x x x x x x x x x x x x x x...
Task 5.2 Numerical Analysis Using Nested Loops (13 pts) Consider the following program: void setup() { //Read a positive integer from the user //Your code starts here } Complete this program such that it calculates all prime numbers between 1 and the value that is assigned to variable num and outputs them on the screen. A prime number is a positive integer that has no other factors other than itself and 1. You should use a nested loop, i.e., write...
In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...
Using Python, Can someone please assist in the following:
These are the hints:
Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to display a warning if the number is less than 2 or greater than 10 and prompt the user to enter the data again until they enter a valid number Put a...
This lab will create a digital clock based on nested FOR loops for hours, minutes, and seconds, and a WHILE loop for doing over and over so that your clock works for all year long without interruption. Note: If a group of students is interested, we could create a real digital wall-mounted clock to be placed in our classroom, so I can keep track of the time during my lectures. The actual clock would be based on the LED Strip...
The method generate() will produce integer arrays of a random size between 10 and 20 members. The method print() will print out the members of an integer array input. The method insert() will accept two arrays as inputs. It will produce a new array long enough to contain both arrays, and both input arrays should be inserted into the new array in the following manner: select a random member of the first array, and insert every member of the second...
the user should be prompted to enter an integer and then your program will produce another integer depending on whether the input was even or odd. The following is an example of what you might see when you run the program; the input you type is shown in green (press Enter at the end of a line), and the output generated by the program is shown in black text. Enter an integer: 1234 Number is even, taking every other digit...