uk
Feedback
Tech Jargon - Decoded

Tech Jargon - Decoded

Відкрити в Telegram

Confused by tech terms? Don’t worry, we’ve got you 🤝 We make things simple, one concept at a time. Learn daily Easy & clear Turn Confusion into clarity. #tech #it #softwareengineer #cs #development

Показати більше
2 015
Підписники
-224 години
-67 днів
-4130 день
Архів дописів
// *
// **
// ***
// **
// *
public class Pattern3{
    public static void main(String args[]){
        int n=5;
        int totalRows=n;
        int stars=1;
        for(int row=1;row<=totalRows;row++){

            for(int starCount=1;starCount<=stars;starCount++){
                System.out.print("*");
            }
            System.out.println();
            if(row <= totalRows/2 ){
                stars++;
            }
            else{
                stars--;
            }
        }
    }
}

//    *
//   ***
//  *****
// *******
public class Pattern2{
    public static void main(String args[]){
        int n=4;
        int totalRows=n;
        int spaces=n-1;
        int stars=1;
        for(int row=1;row<=totalRows;row++){

            // spaces
            for(int countSpaces=1;countSpaces<=spaces;countSpaces++){
                System.out.print(" ");
            }
            //stars
            for(int countStars=1;countStars<=stars;countStars++){
                System.out.print("*");
            }
            System.out.println();
            spaces--;
            stars+=2;
        }
    }
}

// *
// **
// ***
// ****
// *****
public class Pattern1{
    public static void main(String args[]){
        int n=5;
        int totalRows=n;
        for(int row=1;row<=totalRows;row++){
            for(int starCount=1;starCount<=row;starCount++){
                System.out.print("*");
            }
            System.out.println();
            
        }
    }
}

// Program to print following pattern // ******* // * * // // * * public class Pattern5{ public static void main(String args[]){ int n=4; int totalRows=n; int spaces=1; int stars=n-1; for(int row=1;row<=2*n-1;row++){ System.out.print("*"); } System.out.println(); for(int row=2;row<=totalRows;row++){ for(int countStars=1;countStars<=stars;countStars++){ System.out.print("*"); } for(int countSpaces=1;countSpaces<=spaces;countSpaces++){ System.out.print(" "); } for(int countStars=1;countStars<=stars;countStars++){ System.out.print("*"); } System.out.println(); stars--; spaces+=2; } } }

// Program to print following pattern // * // *** // ***** // ******* // ***** // *** // * public class Pattern4{ public static void main(String args[]){ int n=7; int totalRows=n; int spaces=n/2; int stars=1; for(int row=1;row<=totalRows;row++){ for(int spaceCount=1;spaceCount<=spaces;spaceCount++){ System.out.print(" "); } for(int starCount=1;starCount<=stars;starCount++){ System.out.print("*"); } System.out.println(); if(row <= totalRows/2) { spaces--; stars+=2; } else{ spaces++; stars-=2; } } } }

// Program to print following pattern // * // ** // *** // ** // * public class Pattern3{ public static void main(String args[]){ int n=5; int totalRows=n; int stars=1; for(int row=1;row<=totalRows;row++){ for(int starCount=1;starCount<=stars;starCount++){ System.out.print("*"); } System.out.println(); if(row <= totalRows/2 ){ stars++; } else{ stars--; } } } }

// Program to print following pattern // * // *** // ***** // ******* public class Pattern2{ public static void main(String args[]){ int n=4; int totalRows=n; int spaces=n-1; int stars=1; for(int row=1;row<=totalRows;row++){ // spaces for(int countSpaces=1;countSpaces<=spaces;countSpaces++){ System.out.print(" "); } //stars for(int countStars=1;countStars<=stars;countStars++){ System.out.print("*"); } System.out.println(); spaces--; stars+=2; } } }

// Program to print following pattern // * // ** // *** // **** // ***** public class Pattern1{ public static void main(String args[]){ int n=5; int totalRows=n; for(int row=1;row<=totalRows;row++){ for(int starCount=1;starCount<=row;starCount++){ System.out.print("*"); } System.out.println(); } } }

Pattern Programs:

// Program to find corresponding day for a given week number import java.util.Scanner; public class FindCorrespondingDay{ public static void main(String args[]){ int num; System.out.println("Enter the number:(0 to 6):"); Scanner input=new Scanner(System.in); num=input.nextInt(); switch(num) { case 0:System.out.println("Corresponding day for number "+num+" is Sunday"); break; case 1:System.out.println("Corresponding day for number "+num+" is Monday"); break; case 2:System.out.println("Corresponding day for number "+num+" is Tuesday"); break; case 3:System.out.println("Corresponding day for number "+num+" is Wednesday"); break; case 4:System.out.println("Corresponding day for number "+num+" is Thursday"); break; case 5:System.out.println("Corresponding day for number "+num+" is Friday"); break; case 6:System.out.println("Corresponding day for number "+num+" is Saturday"); break; default:System.out.println("Invalid input"); } } }

// Program to read three values and print maximum value among three values import java.util.Scanner; public class MaxOfThree{ public static void main(String args[]){ int num1,num2,num3; System.out.println("Enter three numbers:"); Scanner input=new Scanner(System.in); num1=input.nextInt(); num2=input.nextInt(); num3=input.nextInt(); if(num1>num2 && num1>num3){ System.out.println(num1+" is maximum value"); } else if(num2>num1 && num2>num3){ System.out.println(num2+" is maximum value"); } else{ System.out.println(num3+" is maximum value"); } } }

// Program to take year as an input and check wheather its leap year or not. import java.util.Scanner; public class LeapOrNot{ public static void main(String args[]){ int year; System.out.println("Enter the Year:"); Scanner input=new Scanner(System.in); year=input.nextInt(); if((year%4==0 && year%100!=0) || (year%400 ==0)){ System.out.println(year+" is a leap year"); } else{ System.out.println(year+" is not a leap year"); } } }

//Program to read three angles of a triangle and check if it is a valid or invalid triangle // Valid triangle-A triangle to be valid ,the sum of its angles must be 180,and each angle should be greater than 0. import java.util.Scanner; public class ValidOrNot{ public static void main(String args[]){ int angle1,angle2,angle3,sumAngles; System.out.println("Enter the three angles of triangle:"); Scanner input=new Scanner(System.in); angle1=input.nextInt(); angle2=input.nextInt(); angle3=input.nextInt(); sumAngles=angle1+angle2+angle3; if(sumAngles==180 && angle1>0 && angle2>0 && angle3>0){ System.out.println("Its a valid triangle"); } else{ System.out.println("Its an Invalid triangle"); } } }

// Program to read an integer value from the user and check if it is even or odd import java.util.Scanner; public class EvenOrOdd{ public static void main(String args[]){ int num; System.out.println("Enter a number:"); Scanner input=new Scanner(System.in); num=input.nextInt(); if(num%2==0) { System.out.println(num+" is an even number"); } else{ System.out.println(num+" is an odd number"); } } }

// Program fo find area and volume of cuboid import java.lang.*; import java.util.Scanner; class CuboidArea { public static void main(String args[]) { float l,b,h,area,volume; System.out.println("Enter length ,breadth,height of cuboid:"); Scanner s=new Scanner(System.in); l=s.nextFloat(); b=s.nextFloat(); h=s.nextFloat(); area=2*(l*b+b*h+h*l); volume=l*b*h; System.out.println("Area and volume of cuboid :"); System.out.println("Area:"+area); System.out.println("Volume:"+volume); } }

// Program to know the roots of a quadratic equation import java.lang.*; import java.util.Scanner; class Roots { public static void main(String args[]) { int a,b,c; double r1,r2; System.out.println("Enter the co-efficients:"); Scanner s=new Scanner(System.in); a=s.nextInt(); b=s.nextInt(); c=s.nextInt(); r1=(-b+Math.sqrt((b*b)-4*a*c))/(2*a); r2=(-b-Math.sqrt((b*b)-4*a*c))/(2*a); Systam.out.println("Roots are:") System.out.println("Root 1:"+r1); System.out.println("Root 2:"+r2); } }

// Program to find area of triangle using Heron's formula import java.lang.*; import java.util.Scanner; class Area{ public static void main(String args[]) { float a,b,c,s; double area; System.out.println("Enter the three sides of the triangle:"); Scanner obj=new Scanner(System.in); a=obj.nextFloat(); b=obj.nextFloat(); c=obj.nextFloat(); s=(a+b+c)/2f; area=Math.sqrt(s*(s-a)*(s-b)*(s-c)); System.out.println("Area of triangle:"+area); } }

// Program for computing area of triangle import java.lang.*; import java.util.Scanner; class Area{ public static void main(String args[]) { float b,h,area; System.out.println("Enter base and height of the triangle:"); Scanner s=new Scanner(System.in); b=s.nextFloat(); h=s.nextFloat(); area=(b*h)/2; System.out.println("Area :"+area); } }

// Program to find size and range of a data type import java.lang.*; class DataSizeRange { public static void main(String args[]) { System.out.println("int minimum value:"+Integer.MIN_VALUE); System.out.println("int maximum value:"+Integer.MAX_VALUE); System.out.println("Number of bytes int take:"+Integer.BYTES); System.out.println("byte minimum value:"+Byte.MIN_VALUE); System.out.println("byte maximum value:"+Byte.MAX_VALUE); System.out.println("Number of bytes byte take:"+Byte.BYTES); System.out.println("float minimum value:"+Float.MIN_VALUE); System.out.println("float maximum value:"+Float.MAX_VALUE); System.out.println("Number of bytes float take:"+Float.BYTES); System.out.println("double minimum value:"+Double.MIN_VALUE); System.out.println("double maximum value:"+Double.MAX_VALUE); System.out.println("Number of bytes double take:"+Double.BYTES); System.out.println("Number of bytes char take:"+Character.BYTES); } }

// Program to read name of the person and print a welcome message to him/her. import java.lang.*; import java.util.Scanner; public class ReadName { public static void main(String args[]) { Scanner s=new Scanner(System.in); System.out.print("Enter Your Name:"); String name=s.nextLine(); System.out.println("Welcome, "+name); } }