Earn by twitter on twivert

Sign up for PayPal and start accepting credit card payments instantly.

Thursday, August 19, 2010

WAP To print elements of array


/*WAP To print elements of array*/
/*SAVE AS: PrintArray.java*/

import java.lang.*;
class Array
{
        int l[];
        Array()
        {
        l=new int[] {1,2,3,4,5,6,7,8,9};
        }
        void display()
        {
        for(int i=0;i<9;i++)
        {
  System.out.print("  "+l[i]);
               
        }
        }
}
class PrintArray
{
        public static void main(String arg[])
        {
        Array a1=new Array();
        a1.display();
 }
}

Thursday, August 12, 2010

Shape


#include<stdio.h>
#include<conio.h> 
void main()
{
int i,j,n;
clrscr();  //clear screen

for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
printf("*");
printf("\n");
}
getch();
}

Sunday, August 8, 2010

Shape in c


Shape in C

#include
#include
void main()
{
int i;
char a[10]="*****";
clrscr();
for(i=1;i<=5;i++)
printf("%c\n",a);
getch();
}

Thursday, August 5, 2010

Sum the odd numbers and the even numbers from 1 to an upperbound


/*Sum the odd numbers and the even numbers from 1 to an upperbound*/
public class OddAndEvenSum 
{  // Save as "OddAndEvenSum.java"
   public static void main(String[] args) 
   {
      int sumOdd  = 0;    // for accumulating odd numbers, init to 0
      int sumEven = 0;    // for accumulating even numbers, init to 0
      int upperbound = 10;
      for (int number = 1; number <= upperbound; number++) 
      {
         if (number % 2 == 0) {  // even
            sumEven = sumEven + number;
         } else {                // odd
            sumOdd = sumOdd + number;
         }
      } 
      // print the result
      System.out.println("The sum of odd numbers is " + sumOdd);
      System.out.println("The sum of even numbers is " + sumEven);
      System.out.println("The difference is " + (sumOdd - sumEven));
   }
}

ADS

How to earn online

How to earn online:
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786

AddMe

Bookmark and Share