Assignment 5
Assignment 5
Div-b
Sub-spm
Assignment : 5
Q:1
run:
*
**
***
****
*****
BUILD SUCCESSFUL (total time: 0 seconds)
Q:2
run:
*
**
***
****
*****
BUILD SUCCESSFUL (total time: 0 seconds)
Q:3
run:
@@@@@
@ @
@ @
@ @
@@@@@
BUILD SUCCESSFUL (total time: 0 seconds)
Q:4
import java.util.Scanner;
public class Neer8
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
Name-Megh Patel
Div-b
Sub-spm
int n;
System.out.println("enter the n");
n=sc.nextInt();
for(int i=1;i<=5;i++)
{
for(int j=1;j<i;j++)
{
System.out.print(j);
}
System.out.println("");
}
}
}
run:
enter the n
1
1
12
123
1234
12345
BUILD SUCCESSFUL (total time: 1 second)
Q:5
import java.util.Scanner;
public class Neer9
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n;
System.out.println("enter the n");
n=sc.nextInt();
for(int i=1;i<=n;i++)
{
for(int j=n;j>=i;j--){
System.out.print(j);
}
System.out.println("");
}
}
}
Name-Megh Patel
Div-b
Sub-spm
run:
enter the n
7
7654321
765432
76543
7654
765
76
7
BUILD SUCCESSFUL (total time: 1 second)
Q:6
run:
*******
*******
*******
*******
*******
BUILD SUCCESSFUL (total time: 0 seconds)