source file name: rangeprimenocmd.java class rangeprimenocmd { void prime(int n) { int d=2; while(d<n) { if(n%d==0) break; else d++; } if(d==n) System.out.print(n+" "); } public static void main(String args[]) { rangeprimenocmd p=new rangeprimenocmd(); int n1=Integer.parseInt(args[0]); int n2=Integer.pars…
Read more9) Write a Java program to determine whether they form a triangle and whether triangle is equilateral, isosceles or scalene using 3 numbers.
Write a Java program to by considering three positive integer a,b and c and determine whether they can form three sides of a triangle .if yes determine whether triangle is equilateral, isosceles or scalene. Display the message accordingly. import java.lang.Math; class Triangle { public static void main(String args[]…
Read more8) Write a java program to determine whether they form a triangle and whether triangle is right angle or obtuse or acute using 3 numbers.
Write a java program to by considering three positive integers a,b and c determine whether they can form three sides of a triangle yes determine whether triangle is right angle or obtuse or acute. Display the message accordingly. import java.lang.Math; class RightTriangle { public static void main(String args[]) { i…
Read more7) Write a java program to find and print Reverse number of given number using method. Given number is passed by Command line.
source file name: reversenocmd.java class reversenocmd { void reverse(int no) { int d; long revno=0; while(no>0) { d=no%10; revno=revno*10+d; no=no/10; } System.out.println("reverse number: "+revno); } public static void main(String args[]) { int n=Integer.parseInt(args[0]); reversenocmd ob=new reverse…
Read more6) Write a java program to find the factorial of given number. Compute the factorial value of any number from 1 to 10.
source file name: Factorial.java class Factorial { public static void main(String args[]) { int no=Integer.parseInt(args[0]); int fact=1; for(int i=1;i<=no;i++) fact=fact*i; System.out.println("The Factorial of " + no + " is "+fact); } } output: D:\JavaPrograms\CmdPrograms>javac Factorial.…
Read more5) Write a Java program to input the telephone and number of calls. Calculate and display the bill amount.
Write a java program to input the telephone and number of calls. Calculate and display the bill amount, which include fixed rent of Rs.400.The first 150 calls are free with excess calls are changed at 80 paise each. class PhoneBill { public static void main(String args[]) { int phno=Integer.parseInt(args[0]); int n…
Read more4) Write a Java program to calculate total expenses. A discount of 10% is offered if the quantity purchased is more than 100
source file name: Expenses.java class Expenses { public static void main(String args[]) { int p=Integer.parseInt(args[0]); //conversion of Command line values into integer value if(Integer.parseInt(args[0])>100) System.out.println("The Price is="+(p-(p*10/100))); else System.out.println("The Price…
Read more3) To display Roman Equivalent of decimal number using O-O and Command Line Arguments
source code name: RomanConversionDemo.java class RomanConversionDemo { void roman(int n, char ch) { for(int i=1;i<=n;i++) System.out.print(ch+" "); } public static void main(String[] arg) { int th=0,fh=0,h=0,ft=0,ten=0,fv=0,s=0; int n; RomanConversionDemo ob=new RomanConversionDemo(); n=Integer.parseI…
Read more2) Write a Java program that displays Fibonacci series numbers using Command line arguments.
class fibnumbers { public static void main(String args[]) { int no=Integer.parseInt(args[0]); int a=0,b=1,sum; int n=1; System.out.println("Fibonacci numbers: "); System.out.print(a+","+b); do { sum=a+b; System.out.print(","+sum); a=b; b=sum; n++; }while(…
Read more1) Write a Java program that finds prime numbers between 1 to no , number accepted from Command line.
class Primeno { void prime(int n) { int d=2; while(d<n) { if (n%d==0) break; else d++; } if(d==n) System.out.println(n+"is Prime"); } public static void main(String args[]) { Primeno p=new Primeno(); int no=Integer.parseInt(args[0]); int i,j; for(i=1;i<=no;i++)…
Read more