1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
o-na [289]
4 years ago
10

Write code that causes a "triangle" of asterisks of size n to be output to the screen. specifically, n lines should be printed o

ut, the first consisting of a single asterisk, the second consisting of two asterisks, the third consisting of three, etc. the last line should consist of n asterisks. thus, for example, if n has value 3, the output of your code should be
Computers and Technology
1 answer:
stealth61 [152]4 years ago
4 0
Like this
#include <stdio.h>void  pa(int n){ if(!n){  printf("\n");return;}printf("*");pa(n-1);}void lines(int n){if(!n)  return;lines(n-1);pa(n);}int   main(void){lines(5);return 0;}
You might be interested in
int sequence[10] = { 3, 4, 5, 6, 7, 8, 9, 10, 1, 2 }; Write a C++ program to ask the user to enter a number, if the number can b
Inessa [10]

Answer:

The c++ program to implement search through an array is shown.

#include <iostream>

using namespace std;  

int main()  

{

   int sequence[10] = { 3, 4, 5, 6, 7, 8, 9, 10, 1, 2 };

   int input;

   int found = 0;

   cout << " This program confirms whether your element is present in the array. " << endl;

   cout << " Enter any number  " << endl;

   cin >> input;

   for( int k = 0; k < 10; k++ )

   {

       if( input == sequence[k] )

           found = found + 1;

   }

   if( found == 0 )

       cout << " Not Found " << endl;

   else

       cout << " Found " << endl;

   return 0;

}

OUTPUT

This program confirms whether your element is present in the array.  

Enter any number  

7

Found

Explanation:

The program uses the given integer array.

User is prompted to input any number. No validation is implemented for user input since it is not mentioned. The user input is taken in an integer variable, input.

int input;

cout << " Enter any number " << endl;

   cin >> input;

Another integer variable found is declared and initialized to 0.

int found = 0;

Inside for loop, each element is compared with the user input.

If the user input is present in the given array, variable found is incremented by 1.

for( int k = 0; k < 10; k++ )

   {

       if( input == sequence[k] )

           found = found + 1;

   }

If value of variable found is 0, program displays “ Not Found ”.

If the value of variable found is greater than 0, program displays “ Found ”.

if( found == 0 )

       cout << " Not Found " << endl;

   else

       cout << " Found " << endl;

This program can be tested for both positive and negative numbers.

7 0
3 years ago
What are horizontal and vertical page break? how and where are these inserted?​
Elena L [17]

A. Do this. horizontal page breaks. select the row that is underneath the row where you want the page to break vertical page break....

B. on the layout lab, under page set up, click breaks, and then click insert page break.

Explanation:

DO ONE OF THE FOLLOWING: TO INSERT

4 0
4 years ago
Carla needs to list the role for each consultant. Those with four or more years of 26 15 experience take the Lead role. Otherwis
saveliy_v [14]

Answer :

The output is attached below

Explanation:

The following formula needs to be entered into cell N5:

=IF($M5>=4,"Lead","Associate")

4 0
3 years ago
When a switch is closed, completing an lr series circuit, the time needed for the current to reach one half its maximum value is
uysha [10]
The answer is <span>0.693 .  </span><span>When a switch is closed, completing an LR series circuit, the time needed for the current to reach one half its maximum value is 0.693   

</span>e^(-t/T) = 0.5 
<span>-t/T = ln(0.5) = -0.693 </span>
7 0
3 years ago
When you sit for a typing test, what is the first thought that crosses your mind?
MaRussiya [10]
<span>When you sit for a typing test, what is the first thought that crosses your mind?
posture</span>
8 0
3 years ago
Read 2 more answers
Other questions:
  • What are the correct steps to find the system specifications such as the amount of ram or system type for windows 7 machine?
    5·1 answer
  • We discussed making incremental dumps in some detail in the text. In Windows it is easy to tell when to dump a file because ever
    5·1 answer
  • Write a Python function called simulate_observations. It should take no arguments, and it should return an array of 7 numbers. E
    7·1 answer
  • Linux applications are developed using ________ programming language.
    7·1 answer
  • What type of filtering software divides email messages that have been received into two piles, spam and non-spam and then analyz
    13·1 answer
  • 1, and
    9·1 answer
  • And Python code for the following programming problem and the pseudo code below
    5·1 answer
  • What is computer forensics? Where and how would an IT auditor use thisresource?
    12·1 answer
  • n (m,n) correlating branch predictor uses the behavior of the most recent m executed branches to choose from 2m predictors, each
    11·1 answer
  • Given that the input A is false, the input B is false, and the input C is true, what is the resulting value of the output?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!