Question

I need gelp with writing a c++ code using visual studios to print out this pattern,...

I need gelp with writing a c++ code using visual studios to print out this pattern, please:

1******

       12*****

       123****

       1234***

       12345**

       123456*

       1234567

Homework Answers

Answer #1

Program:

#include <iostream>

using namespace std;

int main()
{
// Declaring variables
int num = 7, num1 = 7;

// This nested for loop will display the pattern
for (int i = 1; i <= num1; i++)
{
for (int j = 1; j <= i; j++)
{
cout << j;
}

num = num - 1;
for (int k = 1; k <= num; k++)
{
cout << "*";
}
cout << endl;
}

return 0;
}

_______________

Output:

_______________

____________Thank YOu

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Print the following two patterns using nested loops. Pattern 1 13579 13579 13579 13579 Pattern 2...
Print the following two patterns using nested loops. Pattern 1 13579 13579 13579 13579 Pattern 2 #####1 ####12 ###123 ##1234 #12345
PYTHON 1.      Complete the attached template program pattenrs.py to create and display a number of patterns. The...
PYTHON 1.      Complete the attached template program pattenrs.py to create and display a number of patterns. The program works with a single digit. The default value is 6, but user to change it as a menu selection. 2.      Program should display the patterns below. Additionally, you need to create your own pattern. 3.      Do not modify myPatterns6 driver. 4.      Make sure you document the program and its functions. 5.      PatternI is already implemented. 6.      Create five additional functions (similar to PatternI function) to implement Patterns II,...
Using Kip irvine32 X86 assembly language using Visual Studios. Please use CORRECT SYNTAX and actually run...
Using Kip irvine32 X86 assembly language using Visual Studios. Please use CORRECT SYNTAX and actually run on Visual Studio as asm file before posting. I keep getting answers that simply solve the problem without writing an actual program that runs on visual studio. Write a program that evaluates the following arithmetic expression: ((A+B)/C) * ((D-A)+E) Assign test values to the variables and display the resulting value.
i need this code to print a number of stars depending on how much the user...
i need this code to print a number of stars depending on how much the user wants and after * it prints no stars. if the user enters a negative number it should print "error invalid number" this is my code so far: def stars(n,i): stars(n, 1) if n <= 0: return "No stars" if i <= n: print("* ", end="") stars(n, i + 1) else: print("no stars") stars(n - 1, 1) n = int(input("enter an integer")) def main(): stars()...
Microsoft Visual Studio in C#: I have this code and need to loop through each element...
Microsoft Visual Studio in C#: I have this code and need to loop through each element of the patient's array and add to a listbox (lbAccountDisplay) each property of the patient's object. This is the 2nd time to ask this question; it should have all the detail you need to help me. It is a piece of a project and I am trying not to give you the whole project. How do I use a foreach loop to loop through...
Using the logic gates and the 7 segment theory, I need to print the word "RIHAMSAM"....
Using the logic gates and the 7 segment theory, I need to print the word "RIHAMSAM". PLEASE provide the TRUTH TABLE, K-MAP, FUNCTION AND THE CIRCUIT DIAGRAM for the word "RIHAMSAM" using the logic gates and 7-segment theory. I also need the picture of the LOGIC CIRCUIT DIAGRAM. Thanks
In C++ code. Given an array with 35 integers, print out only those numbers that occur...
In C++ code. Given an array with 35 integers, print out only those numbers that occur more than once. The 35 integers must be read from a txt file (using fstream) or randomly generated (No user input).
I need a few unit tests done on my SelectionSort program in Visual Studio 2019 with...
I need a few unit tests done on my SelectionSort program in Visual Studio 2019 with MSTest. My program is below. I just need screen shots of the unit test code in Visual Studio 2019 with MSTest. Please and thank you. using System; namespace SelectionSortAlgorithm { public class SelectionSort { public static void Main(string[] args) { int[] dataSet = new int[5] { 2, 99, 27, 68, 3 }; // 5 element array initialized int n = 5; // variable declar...
I need assistance writing this code. I keep generating errors and not sure what to do...
I need assistance writing this code. I keep generating errors and not sure what to do now. Design and implement a method that will take any value as String (even it's a number!) and convert that value to a number in any base. Use the method; private static ArrayList convertToBase(String value, int currentBase, int targetBase){ // your algorithm return result; //which is a String array } Examples: convertToBase("10011", 2, 10) should return [1, 9], meaning, (10011)base2 = (19)base10 convertToBase("100", 10,...
Use a Switch statement.A switch statement is just another way of writing an IF statement. The...
Use a Switch statement.A switch statement is just another way of writing an IF statement. The user will enter f, s, j, or r from the keyboard for freshman, sophomore, junior, or senior. Use character data type for c++. Then you can say something like: char level ='f'; level=toupper(level); You would need a loop for 1 to 5, to test for f, s, j, r and also an illegal grade level. Use a "z" for the illegal grade level Convert...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT