Pattern Programs
Project 1:-
Top 100+ Sql Server Interview Questions
import java.util.Scanner; public class MainClass_sawan{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); //Taking rows value from the user System.out.println("How many rows you want in this pattern?"); int rows = sc.nextInt(); System.out.println("Here is your pattern....!!!"); //Printing upper half of the pattern for (int i = 1; i <= rows; i++) { for (int j = 1; j <= i; j++) { System.out.print(j+" "); } System.out.println(); } //Printing lower half of the pattern
for (int i = rows-1; i >= 1; i--) { for (int j = 1; j <= i; j++) { System.out.print(j+" "); } System.out.println(); } //Closing the resources sc.close(); }}
import java.util.Scanner;
public class MainClass_sawan_test
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
//Taking rows value from the user
System.out.println("How many rows you want in this pattern?");
int rows = sc.nextInt();
System.out.println("Here is your pattern....!!!");
for (int i = 1; i <= rows; i++)
{
for (int j = rows; j >= i; j--)
{
System.out.print(j+" ");
}
System.out.println();
}
//Closing the resources
sc.close();
}
}
import java.util.Scanner; public class MainClass_sawan_test{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); //Taking rows value from the user System.out.println("How many rows you want in this pattern?"); int rows = sc.nextInt(); System.out.println("Here is your pattern....!!!"); for (int i = 1; i <= rows; i++) { for (int j = rows; j >= i; j--) { System.out.print(j+" "); } System.out.println(); } //Closing the resources sc.close(); }}
import java.util.Scanner;
public class MainClass_test
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
//Taking rows value from the user
System.out.println("How many rows you want in this pattern?");
int rows = sc.nextInt();
System.out.println("Here is your pattern....!!!");
for (int i = 1; i <= rows; i++)
{
for (int j = 1; j <= i; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
//Close the resources
sc.close();
}
}
import java.util.Scanner; public class MainClass_test{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); //Taking rows value from the user System.out.println("How many rows you want in this pattern?"); int rows = sc.nextInt(); System.out.println("Here is your pattern....!!!"); for (int i = 1; i <= rows; i++) { for (int j = 1; j <= i; j++) { System.out.print(j+" "); } System.out.println(); } //Close the resources sc.close(); }}
mport java.util.Scanner; public class MainClass_dizswed{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
//Taking rows value from the user
System.out.println("How many rows you want in this pattern?");
int rows = sc.nextInt();
System.out.println("Here is your pattern....!!!");
for (int i = rows; i >= 1; i--)
{
for (int j = i; j >= 1; j--)
{
System.out.print(j+" ");
}
System.out.println();
}
//Closing the resources
sc.close();
}
}
public static void main(String[] args)
{ Scanner sc = new Scanner(System.in); //Taking rows value from the user System.out.println("How many rows you want in this pattern?"); int rows = sc.nextInt(); System.out.println("Here is your pattern....!!!"); for (int i = rows; i >= 1; i--)
{ for (int j = i; j >= 1; j--) { System.out.print(j+" "); } System.out.println(); } //Closing the resources sc.close(); }}
class PalindromeExample{ public static void main(String args[]){ int r,sum=0,temp; int n=454;//It is the number variable to be checked for palindrome temp=n; while(n>0){ r=n%10; //getting remainder sum=(sum*10)+r; n=n/10; } if(temp==sum) System.out.println("palindrome number "); else System.out.println("not palindrome"); }
No comments:
Post a Comment