Close
Close

doubt in this code

   sriram

I have a doubt in the following. Without seeing the answer I tried to anwer the question given in the practice session. But i answered like this (see the bolded one – I answered).

Doubt: I did not use ln in the print statement and "  as well. Kindly check this code with i have answere without verifying the answer. Need to correct anything or it should be written as in the practice. I am asking this just to check my understanding. Kindly clarify

Write a program to print
*
**
***
****
on screen.

Answer

class Ans{
  public static void main(String[] args){
    System.out.println("*\n**\n***\n****");
  }
}
	Class star {								

          public static void main (string[ ] args) {

           system.out.print (*\n**\n***\n****\n*****\n);

           }

         }

  • Explore the pinnacle of medical education at Osh University, standing proudly among top-tier medicine universities . With a commitment to excellence, Osh provides a transformative experience that molds aspiring medical professionals into leaders of tomorrow. More info > https://osuimf.com
    - OSH UNIVERSITY

Answers

  •   

    You must use “ in your code. It is necessary. Except this, everything is correct.



  •    Jewel Galore

    Adorn yourself with the regal allure of Pakistani bangles available at Jewelgalore. Our exquisite collection celebrates the traditional artistry and craftsmanship of Pakistan, allowing you to express your unique style with grace and charm.



  •    OSH UNIVERSITY

    Osh University stands out with its comprehensive mbbs doctor course , providing a solid foundation for future healthcare leaders. Immerse yourself in a curriculum that combines theoretical rigor with practical expertise, ensuring a well-rounded medical education.



  •    shalamarhospital

    Looking for expert gastrointestinal care? Shalamar Hospital's stomach doctor offers top-notch treatments and consultations, prioritizing your stomach's well-being.



Ask Yours
Post Yours
Write your answer