Question

Modify the program to print: * * * * * * * * * * *...

Modify the program to print:

* * * * *

* * * *

* * *

* *

*

The program previously used to create:

*
* *

* * *

* * * *

* * * * *

int i,j;

for (i=1; i<=5; i++) {

for (j=1; j<=i; j++) {

System.out,print("*");

}

System.out,println();

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here you go :)

comment if you have any doubts

output

EL Problems @ Javadoc ? Declaration ApSearch Console X O Progress ?**

//Pattern class

public class Pattern {
   public static void main(String[] args) {
       int i, j;
       for (i = 1; i <= 5; i++) {
           for (j = 0; j <= 5-i; j++) {
               System.out.print("*");
           }
           System.out.println();
       }
   }
}

Add a comment
Know the answer?
Add Answer to:
Modify the program to print: * * * * * * * * * * *...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the following Java program, modify the code so that every time you run your program,...

    Using the following Java program, modify the code so that every time you run your program, it generates random numbers for your array, and then prints it (insertion sort) import java.awt.Graphics; import java.applet.Applet; public class SortingProg extends Applet { int a[] = { 55, 25, 66, 45, 8, 10, 12, 89, 68, 37 }; public void paint(Graphics g)     {       print(g,"Data items in original order",a,25,25);       sort();       print(g,"Data items in ascending order",a,25,55);     } public void sort() {...

  • What does the program print, and if possible can you give an explanation of how you...

    What does the program print, and if possible can you give an explanation of how you reached the answer? . What will the following program print? class Quiz03 public static void main (String [] args) final int limit = 5; ( string line""i string line = "" ; for ( int j=1 ; j <= row; j++ ) for int row=1; row<=limit; row++ ) line += "*" ; System.out.println( line

  • ere is a short Processing program that intends to print out the square numbers (Links to...

    ere is a short Processing program that intends to print out the square numbers (Links to an external site.)Links to an external site.: 1, 4, 9, 16, 25, 36, 49, and so on. void setup() { int[] squares; for(int i = 0; i < squares.length; i++) { squares[i] = i * i; } for(int s : squares) { println(s); } } Java will not allow this program to compile and run because of built-in memory protections. Which problem mentioned in...

  • Create a new file (in Dev C++) Modify program above to use a vector instead of...

    Create a new file (in Dev C++) Modify program above to use a vector instead of an array. Header comments must be present Prototypes must be present if functions are used Hello and goodbye messages must be shown Vector(s) must be used for implementation Use comments and good style practices ====================================================================================================== #include <iostream> using namespace std; int main() { cout<<"Welcome! This program will find the minimum and maximum numbers in an array."<<endl; cout<<"You will be asked to enter a number...

  • Task 5.2 Numerical Analysis Using Nested Loops (13 pts) Consider the following program: void setup() {...

    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...

  • Modify the following given Java program. You are expected to modify the supplied Exercise1.java to print...

    Modify the following given Java program. You are expected to modify the supplied Exercise1.java to print just the last lines of each paragraph in HTML format. Copy and paste the Sample input on the console then print the Expected output. import java.util.Scanner; public class Exercise1 { /** A simple static string for HTML & table header. */ private static final String HTMLHeader = "<!DOCTYPE html>\n" + " <html>\n" + " <head>\n" + " <title>CSE: Exercise 1</title>\n" + " </head>\n" +...

  • This is my program in C. I should be able to print out Monday, Tuesday and...

    This is my program in C. I should be able to print out Monday, Tuesday and Wednesday. However, I am not sure what I am doing wrong. Please tell me. So far I get these errors: warning: ‘enum day’ declared inside parameter list will not be visible outside of this definition or declaration const char* DayToString(enum color x)// I guess this is just a warning, nothing wrong error: parameter 1 (‘x’) has incomplete type const char* DayToString(enum color x) //I...

  • use the same code. but the code needs some modifications. so use this same code and...

    use the same code. but the code needs some modifications. so use this same code and modify it and provide a output Java Program to Implement Merge Sort import java.util.Scanner Class MergeSort public class MergeSort Merge Sort function / public static yoid sortfintfl a, int low, int high) int N-high-low; if (N1) return; int mid- low +N/2; Il recursively sort sort(a, low, mid); sort(a, mid, high); I/ merge two sorted subarrays int] temp new int[N]; int i- low, j-mid; for...

  • Add binary_search() (page 462) to your program. Modify main() to prompt the user for a number...

    Add binary_search() (page 462) to your program. Modify main() to prompt the user for a number to search (until ^D) and display the position of the number in the sorted vector. Try your program for the following user input: 1 15 18 40 30 50 ^D The output should be: -1 2 -1 7 5 -1 int binary_search(vector<int> v, int from, int to, int value) { if (from > to) return -1; int mid = (from + to) / 2;...

  • •Write a java program to read 10 numbers and print them in reverse order. Modify your...

    •Write a java program to read 10 numbers and print them in reverse order. Modify your program to work for N numbers given by the user Extend your program to find the average of these numbers Extend your program to find the smallest number of these numbers Extend your program to find the largest number of these numbers •Write a program to read 10 numbers and print them in reverse order. Modify your program to work for N numbers given...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT