Article archive
To print the sum of first 20 natural numbers
18/03/2013 08:26
public class adding20naturalnumbers
{
public static void main(String args[])
{
int sum=0;
for(int i=1;i<=20;i++)
{
sum=sum+i;
System.out.println(sum);
}
}
}
New content uploaded
18/03/2013 05:00
Some of the content like 3 methods of calling functions into "MAIN" method and 9th STD. programs are uploaded
Write a program describing different methods of defining functions and calling them into main method
16/03/2013 20:09
Here are 4 methods of defining functions
public class functons
{
void add1()
{
int a=7;
int b=9;
int c=a+b;
System.out.println(c);
}
void add2(int a,int b)
{
int c=a+b;
System.out.println(c);
}
int add3()
{
int a=9;
int b=7;
int...
This program is used for swaping values ie interchanging one value with another eg: int a=9; int b=10; now interchange int a=10; int b=9; * also overloaded functions are explain ie having same name of function but different parameters used for it
16/03/2013 20:07
This is also the simple method of calling functions in main method
public class xyz
{
void swap(int a,int b)
{
int c;
c=a;
a=b;
b=c;
System.out.println(a);
System.out.println(b);
}
void swap()
{
int a=5;
int b=6;
int...
Visitors notice
16/03/2013 13:23
If I have made any mistake in source code please correct me. To do that please email me at humurabbi@gmail.com
Please do not forget to give feedback in "Contact me" section
Website launched
16/03/2013 13:22
My new website has been launched today.
This website is been created for the benefit to all my friends.I wiil provide you with source codes and update it regularly
Write a program and define the function "area" to find area of rectangle square and triangle.
16/03/2013 13:22
Here is it
public class recsqutri
{
void area(int l,int b)
{
int area=l*b;
System.out.println(area);
}
void area()
{
int side=5;
int area=side*side;
System.out.println(area);
}
void area(double a,double b,double c)
{
double...
To check whether the number is prime or composite
18/01/2013 08:24
public class primecomposite
{
public static void main(String args[])
{
int n=56;
int c=0;
for(int a=1;a<=n;a++)
{
if(n%a==0)
c++;
}
if(c==2)
System.out.println("the number is prime");
else
System.out.println("the number is composite");
}
}
To print squares of 10 numbers from one to ten
01/01/2002 08:24
public class squaresofnumbers
{
public static void main(String args[])
{
for(int i=1;i<=10;i++)
System.out.println(i*i);
}
}
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...
Items: 21 - 30 of 39