Article archive
Calculate discount on the basis of sales
01/01/2002 08:22
public class calculatingdiscountsonsales
{
public static void main(String args[])
{
int sales=2000;
double discount=0;
if(sales>15000)
{
discount=0.3;
double prize=sales*discount;
System.out.println(prize);
System.out.println("discount is 30...
Print which number is largest
01/01/2002 08:19
public class printinglargeorsmallnumbers
{
public static void main(String args[])
{
int n1=95;
int n2=95;
{
if(n1>n2)
System.out.println("1st is largest");
if(n2>n1)
System.out.println("2nd is largest");
if(n2==n1)
System.out.println("both are...
Print whether the number is odd or even
01/01/2002 08:17
public class oddeven
{
public static void main(String args[])
{
int a=53;
if(a%2==0)
System.out.println("the number is even");
else
System.out.println("the number is odd");
}
}
Generate table of any number
01/01/2002 08:16
public class generatingtables
{
public static void main(String args[])
{
int x=95;
for (int a=1;a<=10;a=a+1)
{
int y=x*a;
System.out.println(y);
}
}
}
Calculate percentage of student on basis of 5 subject marks and also give grades on basis of percentage
01/01/2002 08:14
*/
public class Studentpercentage
{
public static void main(String args[])
{
String Student;
int a=75;
int b=72;
int c=71;
int d=79;
int e=69;
int f=a+b+c+d+e;
int percentage=f*100;
double...
Write a program to print febonicci series
01/01/2002 08:13
public class febonicci
{
public static void main(String args[])
{
int c;
int a=0;
int b=1;
System.out.println(a+" "+b);
for(int i=3;i<=20;i++)
{
c=a+b;
a=b;
b=c;
System.out.println(c);
}
}
}
Write a program with overloaded function volume() to calculate the volume of cube,cuboid and a cylinder
01/01/2002 08:01
public class husain
{
void volume(int l,int b,int h)
{
int volume=l*b*h;
System.out.println(volume);
}
void volume()
{
int side=5;
int volume=side*side*side;
System.out.println(volume);
}
void volume(double a,double b,double c)
{
double d=a*b*c;
double...
To call swap programs into main method using third way
01/01/2002 07:49
This type of calling function into main method is called as "call by reference" method
public class reference
{
int a=10;
int b=15;
void swap(reference ob1)
{
int c;
c=ob1.a;
ob1.a=ob1.b;
ob1.b=c;
System.out.println(a);
System.out.println(b);
}
public static void...
Another way by which we can call swap program into main method f
01/01/2002 07:42
This method of calling is also called as "call by values"
public class values
{
void swap(int a,int b)
{
int c;
c=a;
a=b;
b=c;
System.out.println(a);
System.out.println(b);
}
public static void main(String args[])
{
int x=10;
int y=15;
values ob1=new...
Items: 31 - 39 of 39