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
Nataly [62]
3 years ago
10

Assume that the int variables i and j have been declared, and that n has been declared and initialized.

Computers and Technology
1 answer:
Sonja [21]3 years ago
6 0

Answer:

The code to this question can be given as:

code:

for(i=1;i<=n;i++)   //for loop column

{

for(j=1;j<=i;j++)       //for loop for rows

{

printf("*");         // print asterisks

}

printf("\n");     //line break

}

Explanation:

We know that variable i,j, and n is already declared and n variable has initialized a value. So, we write the code that is given above. In this code, we use a nested loop. In this code, we use two loops that are a loop (i)for column and j loop for rows. for print asterisks triangle we use two for loop. For that, we use two-variable (i,j) that is already declared. We assign the value in (i) loop that is 0 and checks that (i) is less than equal to n and increment of (i) by 1. In this loop, we use another loop that is (j) loop. It also starts from 1 and checks that (j) is less than equal to (i)and increment of (j) by 1. In that loop, we print asterisks end of (j) loop. In (i) loop we use ("\n") for line break end of (i) loop.

You might be interested in
You should process the tokens by taking the first letter of every fifth word,starting with the first word in the file. Convert t
zhenek [66]

Answer:

See explaination

Explanation:

import java.io.File;

import java.io.IOException;

import java.util.Scanner;

import java.util.StringTokenizer;

public class SecretMessage {

public static void main(String[] args)throws IOException

{

File file = new File("secret.txt");

StringBuilder stringBuilder = new StringBuilder();

String str; char ch; int numberOfTokens = 1; // Changed the count to 1 as we already consider first workd as 1

if(file.exists())

{

Scanner inFile = new Scanner(file);

StringTokenizer line = new StringTokenizer(inFile.nextLine()); // Since the secret.txt file has only one line we dont need to loop through the file

ch = line.nextToken().toUpperCase().charAt(0); // Storing the first character of first word to string builder as mentioned in problem

stringBuilder = stringBuilder.append(ch);

while(line.hasMoreTokens()) { // Looping through each token of line read using Scanner.

str= line.nextToken();

numberOfTokens += 1; // Incrementing the numberOfTokens by one.

if(numberOfTokens == 5) { // Checking if it is the fifth word

ch = str.toUpperCase().charAt(0);

stringBuilder = stringBuilder.append(ch);

numberOfTokens =0;

}

}

System.out.println("----Secret Message----"+ stringBuilder);

}

}

}

5 0
3 years ago
Exercise : Randomizer In this exercise, we are going to create a static class Randomizer that will allow users to get random int
Nutka1998 [239]

Answer:

Here the code is by using java.

Explanation:

//Randomizer.java

public class Randomizer {

public static int nextInt() {

//get random number from 1-10

int randInteger = (int) (Math.random() * (11) + 1);

//if number is greater than 10 or less than 1

while (randInteger > 10 || randInteger < 1) {

randInteger = (int) (Math.random() * (11) + 1);

}

return randInteger;

}

public static int nextInt(int min, int max) {

//formula to get random number from min-max

int randInteger = (int) (Math.random() * (max + 1) + min);

while (randInteger > max || randInteger < min) {

randInteger = (int) (Math.random() * (max + 1) + min);

}

return randInteger;

}

}

//RandomizerTester.java

public class RandomizerTester {

public static void main(String[] args) {

System.out.println("Results of Randommizer.nextInt()");

for (int i = 0; i < 10; i++) {

System.out.println(Randomizer.nextInt());

}

int min = 5;

int max = 10;

System.out.println("\n Results of Randomizer.nextInt(5,10)");

for (int i = 0; i < 10; i++) {

System.out.println(Randomizer.nextInt(min, max));

}

}

}

OUTPUT:

Results of Randommizer.nextInt()

9

2

3

8

5

9

4

1

9

2

Results of Randomizer.nextInt(5,10)

9

8

9

7

5

10

5

10

7

7

4 0
2 years ago
1. what is the purpose of giving an id to an html element when using javascript?
bazaltina [42]

Answer:

It is also used by JavaScript to access and manipulate the element with the specific id.

3 0
2 years ago
Which element of presentation software can you use to add callouts and banners?
Harrizon [31]
<span><span>1.)From the Insert tab, select the Shapes command. A drop-down menu will appear.
</span><span>2.)Select the desired shape
3.)</span></span>Click and drag<span> the slide to create the shape. You may need to move or resize the shape so it points to the desired part of the image.
4.)</span><span>f you want your callout to contain text, start typing while the shape is selected.
5.)</span><span>From the </span>Format<span> tab, you can use the options in the </span>Shape Styles<span> group to customize the appearance of the shape. You can also adjust the font from the Home tab</span>
7 0
3 years ago
Read 2 more answers
Write a C++ function for the following:
Nana76 [90]

Solution :

class Account

$ \{ $

public:

$\text{Account}()$;

double $\text{getBalance}$();

void $\text{setBalance}$();

$\text{bool withdraw}$(double bal);

$\text{private}:$

double $\text{balance}$;

}:

$\text{Account}()$ {}

double $\text{getBalance}$()

$ \{ $

$\text{return balance}$;

}

void $\text{setBalance}$(double $\text{balance}$)

$ \{ $

this.$\text{balance}$ = $\text{balance}$;

}

$\text{boolean}$ withdraw($\text{double bal}$)

$ \{ $

if($\text{balance}$ >= bal)

$ \{ $

$\text{balance}$ = $\text{balance}$ - bal;

$\text{return}$ true;

}

$\text{return}$ false;

}

}

4 0
2 years ago
Other questions:
  • Define a function begins_with_line that consumes a string and returns a boolean indicating whether the string begins with a dash
    15·1 answer
  • What's another name for the Super High shot, if you shot it on the ground using a tripod?
    14·1 answer
  • ___________is a security strategy that applies multiple layers of defense because there is an assumption that any single protect
    12·1 answer
  • 1.) Florida has ____________ roads that are designated as part of the National Highway System.
    12·1 answer
  • PLEASE HELP!! WILL MARK BRAINLIEST!!
    9·1 answer
  • Which staff member takes a set of plans and supervises their construction?
    6·1 answer
  • If the tax percent is 15% and tax is $36 and percent discount is 10, what is the cost price?​
    12·1 answer
  • What might a designer need to consider when choosing an appropriate energy source for products and power systems
    15·1 answer
  • can you still receive messages on messenger from a person when you deleted the conversation with them? (But not blocked them)
    14·2 answers
  • A successful entrepreneur is
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!