Posts

JAVA-----------Hand cricket

 import java.util.Scanner; public class Hand_cricket { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Lets have a toss first.");     int t1;     int t2;     int t3;     System.out.print("choose 0 for head or 1 for tail: ");     t1 = sc.nextInt();     t2 = (int) (Math.random()*2);     // 0 --> head ; 1 --> tail;     if((t1 == 0)||(t1 == 1)){         int choice;         int your1;         int comp1;         int your2;         int comp2;         if(t1 == t2){         //toss won;         System.out.println("you won the toss.");         System.out.println("you wanna bat or bowl first?");         System.out.print(...

JAVA-----------------Number patterns

1. 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 for(int i = 1 ; i <= 5 ; i++) { for(int j = 1 ; j <= i ; j++) System.out.print(j + " "); System.out.println(); } 2. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 int count = 0; for(int i = 1 ; i <= 5 ; i++) { for(int j = 1 ; j <= i ; j++) System.out.print(++count + " "); System.out.println(); } 3. 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 for(int i = 1 ; i <= 5 ; i++) { for(int j = i ; j >= 1 ; j--) System.out.print(j + " "); System.out.println();  } 4. 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1 for(int i = 1 ; i <= 5 ; i++) { for(int j = 1 ; j <= i ; j++) System.out.print(j + " "); for(int k = i-1 ; k >= 1 ; k--) System.out.print(k + " "); System.out.println(); } 5. 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5 for(int i = 1 ; i <= 5 ; i ++) { for(int j = 5 ; j >= i ; j--) System.out.print(j + " "); Syst...

JAVA-----------Star patterns

1. * ** *** **** ***** for(int i = 1 ; i <= 5 ; i++) { for(int j = 1 ; j <= i ; j++) System.out.print("*"); System.out.println(); } 2. ***** **** *** ** * for(int i = 5 ; i >= 1 ; i--) { for(int j = 1 ; j <= i ; j++) System.out.print("*");     System.out.println(); } 3. * ** *** **** ***** **** *** ** * for(int i = 1 ; i <= 5 ; i++) { for(int j = 1 ; j <= i ; j++) System.out.print("*"); System.out.println(); } for(int i = 4 ; i >= 1 ; i--) { for(int j = 1 ; j <= i ; j++) System.out.print("*"); System.out.println(); } 4.         *       **     ***   **** ***** for(int i = 1 ; i <= 5 ; i++) { for(int j = 5 ; j > i ; j--) System.out.print(" "); for(int k = 1 ; k <= i ; k++) System.out.print("*"); System.out.println(); } 5. *****   ****     ***       **        ...

JAVA-------SEM-1 Assignment 7

 Q_01 Scanner in = new Scanner(System.in); System.out.print("Enter the size of array: "); int n = in.nextInt(); double[] arr = new double[n]; double sum = 0 , average; for(int i = 0 ; i < n ; i++) { arr[i] = Math.random(); sum += arr[i]; } average = sum/n; System.out.println("Sum = " + sum); System.out.println("Average = " + average); Q_02 int[] arr = new int[101]; Scanner in = new Scanner(System.in); System.out.println("The program ends when you enter 0"); int n = 0; do { System.out.print("Enter the any number between 1 to 100: "); n = in.nextInt(); arr[n]++; }while(n!=0); for(int i = 1 ; i < 101 ; i++) { if(arr[i]!=0) { System.out.println(i + " is entered "+ arr[i] + (arr[i]==1?" time." : " times.")); } } Q_03 int[] arr = new int[10]; Scanner in = new Scanner(System.in); System.out.print("Enter the 10 integer...

HTML----------Employee form

Employee Present 50% Employee Interests Survey form Enter your name: Enter your department: Tell us a little about yourself: Do you exercise at home? yes no How do you like to read about your favourite topics? Books Online resources Phone apps Magazines What genre of movies do you like? Comedy Action Adventure Horror Thriller
Image
Document NAME:Teelu SPECIES:Dog BREED:Pomeranian Descended from large sled dog breeds, the now-tiny Pomeranian has a long and interesting history. The foxy-faced dog, nicknamed “the little dog who thinks he can,” is compact, active, and capable of competing in agility and obedience or simply being a family friend. Poms may be small, but they don’t always act that way and may even challenge larger dogs. While they make for good apartment pets, they can also bark a lot, which your neighbors may not be too thrilled about. But as long as you give your dog plenty of exercise and playtime, keep them out of hot weather, and give them lots of love and attention, you’ll have a loving, adorable, furry family companion! NAME:Rishav SPECIES:Humans BREED:Befkoof Humans (Homo sapiens) are highly intelligent primates that have become the dominant species on Earth. They are the only exta...

JAVA-------SEM-1 Assignment 6

 Q_01 import java.util.Scanner; public class Q_01 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter the value of a and b: "); int a = in.nextInt(); int b = in.nextInt(); System.out.println("a + b = " + additionSimple(a , b)); System.out.println("a - b = " + substractionSimple(a , b)); System.out.println("a * b = " + multiplicationSimple(a , b)); System.out.println("a % b = " + remainderSimple(a , b)); System.out.println("a / b = " + divisionSimple(b , a)); System.out.println("sqrt of a = " + squarerootSimple(a)); System.out.println("sqrt of b = " + squarerootSimple(b)); } public static int additionSimple(int a , int b) { int c = a + b ; return c; } public static int substractionSimple(int a , int b) { int c = a - b ; return c; } public static int multiplicationSimple(int a , int b) { int c = a...