Q:

Calculate Serious Program Using Java

0

This Program is used to calculate Serious Program

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

// serious program 

import java.io.*; 
class ssv123 
{ 
public static void main(String args[]) throws IOException 
{ 
int i,j,b,n; 
String s; 

DataInputStream a = new DataInputStream(System.in); 
System.out.println("enter the number:"); 

s = a.readLine(); 
n=Integer.parseInt(s); 

for(i=1;i<=n;i++) 
{ 
for(j=1;j<=i;j++) 
{ 
System.out.println(j + " "); 
} 
} 
for(i=n;i>=1;i--) 
{ 
for(j=i;j>=1;j--) 
{ 
System.out.println(i + " "); 
} 
} 
for(i=1;i<=n;i++) 
{ 
for(j=1;j<=i;j++) 
{ 
System.out.println(i + " "); 
} 
} 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now