This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Electricity_bill { | |
public static void main(String[] args){ | |
int rate,unit,bill; | |
System.out.println("Electricity bill calculator\n\n"); | |
Scanner sc=new Scanner(System.in); | |
System.out.println("Enter Unit: "); | |
unit=sc.nextInt(); | |
if(unit<=100) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Calculator { | |
public static void main(String[] args) { | |
int a,b; | |
Scanner sc=new Scanner(System.in); | |
System.out.println("Enter the 1st digit:"); | |
a=sc.nextInt(); | |
System.out.println("Enter the operator"); | |
String opr=sc.next(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rule - User will have 5 chances to guess the correct number | |
import java.util.Scanner; | |
public class Number_guess { | |
public static void main(String[] args) { | |
//generating a random number | |
int myNumber = (int) (Math.random() * 100); | |
int guess,i=5; |