Skip to content

This task is a part of Local Hack Day organized by Major League Hacking.

Notifications You must be signed in to change notification settings

arpanaditya/LHD-Learn-a-New-Programming-Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

LHD Challenge: Learn a New Programming Language

This is a part of challenges by Local Hack Day organized by MLH

What we have learnt:

JAVA

We learnt about a new programming language which is JAVA. We have planned and choose a programming language which was new to all of us. We have tried and gone through the basics of that programming language.

Below there are some basics programs which we have written in java language:

Sheetal's code goes here
public class lhd {

  static int fib(int x) {
  	if (x == 0) {
  		return 0;
  	} else if (x == 1) {
  		return 1;
  	} else {
  		return fib(x - 1) + fib(x - 2);
  	}
  }
  public static void main(String[] args) {
  	Scanner sc = new Scanner(System.in);
  	System.out.print("Enter The number of terms: ");
  	int n = sc.nextInt();
  	for (int i = 0; i <= n; i++) {
  		System.out.print(fib(i) + " ");
  	}
  }
}
public class lhd {
 public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    System.out.print("Input weight in kilogram: ");
    double weight = sc.nextDouble();
    System.out.print("\nInput height in meters: ");
    double height = sc.nextDouble();
    double BMI = weight / (height * height);
    System.out.print("\nThe Body Mass Index (BMI) is " + BMI + " kg/m2");
		 }
  }
public class lhd {

  public static void main(String[] args) {
  	Scanner prime = new Scanner(System.in);
  	
  	System.out.println("Enter a number: ");
  	
  	int n = prime.nextInt();
  	
  	boolean isPrime = true;
  	
  	for (int i = 2; i < n; i++) {
  		
  		if (n%i == 0) {
  		isPrime = false;
  		break;
  		}
  		
  	}
  	
  	if (n < 2) isPrime = false;
  		
  	System.out.println(isPrime);
  	
  	prime.close();
  }
}

About

This task is a part of Local Hack Day organized by Major League Hacking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •