🔒 Closed Java help

Status
Not open for further replies.
lods pano ba to nag eeror ng "cannot find the symbol

import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num;

System.out.print ("Choose from 5 triangles :1 - Left Triangle. 2 - Right Triangle. 3 - Reversed Left Triangle. 4 - Reversed Right Triangle. 5 - Full Triangle ");
System.out.print ("Choose Number: ");
num= scan.nextInt();

if(num == 1)
{System.out.print ("Enter Number: ");
int n = sc.nextInt();
//square//
for (int i = 1; i <= n; i++) {
for (int j = 1; j<= n; j++){
System.out.print ("* ");
}
System.out.println();
}
}

else if(num == 2)
{System.out.print ("Enter Number: ");
int n = sc.nextInt();
//increasing triangle//
for (int i = 1 ; i <= n; i++) {
for (int j= 1 ;j <= i; j++){
System.out.print("* ");
}
System.out.println();
}
}
else
{System.out.print ("try again");}
}
}
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 692
    Views
  • 2
    Participants
Last reply from:
JakeMosby

Trending Topics

Online now

Members online
1,235
Guests online
1,460
Total visitors
2,695

Forum statistics

Threads
2,287,342
Posts
29,044,002
Members
1,216,478
Latest member
kirolololol
Back
Top