Earn by twitter on twivert

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

Tuesday, August 31, 2010

WAP to use of sizeof


/*use of sizeof*/

#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
char a;
int b;
float c;
double d;
a=sizeof(char);
b=sizeof(int);
c=sizeof(float);
d=sizeof(double);

printf("\nsize of char=%d\n",a);
printf("\nsize of integer=%d\n",b);
printf("\nsizeof float=%f\n",c);
printf("\nsize of d float=%f\n",d);
getch();
}

Sunday, August 29, 2010

WAP to find number is Armstrong Number or not


/*WAP to find number is Armstrong Number or not*/
#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
    int no,dig,temp,sum=0;

    clrscr();

    printf("Enter no : ");
    scanf("%d",&no);

    temp=no;

    while(temp>0)
    {
 dig=temp%10;

 sum=sum+dig*dig*dig;

 temp=temp/10;
    }

    if (no==sum)
 printf("\n %d is an Armstrong Number",no);
    else
 printf("\n %d is not an Armstrong Number",no);

    getch();
 }

Saturday, August 28, 2010

WAP of Star Shape


/*WAP of Star Shape*/
#include
#include
void main()
{
int i,n,j;
clrscr();   //clear screen
printf("Enter value of n:");
scanf("%d",&n);
for(i=1;i<=n;i++) //loop starts from 1 for row
{
for(j=1;j<=i;j++)   // loop executes i times for colom
printf("%d",j);   // print j
printf("\n");    // goto next line
}
getch();
}

Thursday, August 26, 2010

WAP to swap two number


/*WAP to swap two number*/
#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c;
 clrscr();
 printf("enter value of a");
 scanf("%d",&a);
 printf("enter value of b");
 scanf("%d",&b);
 c=a;
 a=b;
 b=c;
 printf("\nswaped value of a is=%d",a);
 printf("\nswaped value of b is=%d",b);
 getch();
}

Wednesday, August 25, 2010

WAP to print stars


/*WAP to print stars*/
/*Save as : Star.java*/
import java.lang.*;
class Star
{
        public static void main(String arg[])
        {
                int i;
                for(i=0;i<1;i++)
                {
                  System.out.print("* ");
                }
                for(i=0;i<5;i++)
                {
                  System.out.println("*");
                }

        }
}

Thursday, August 19, 2010

WAP To print addition of two array element’s


/*To print addition of two array element’s*/

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

WAP to add item to list box




'controls       Property        Setting

'Textbox1        Name            Text1
'                Caption           -

'List1           Name            List1 
                
'Label1          Name            Lebel1
'                Caption          Enter Any Thing

'Label2          Name            Lebel2
'                Caption           Added

'command1        Name            command1
'                Caption         Add
          
'-----------------------------------------------------
'                        CODE

Private Sub command1_click()
If Text1.text<>"" Then
List1 AddItem(Text1.text)
msgbox("You must enter something in list")
End If
else
List1 AddItem(Text1.text)
End Sub

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));
   }
}

Sunday, August 1, 2010

Star Shape 2


#include
#include
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
printf("*");
printf("\n");
}
getch();
}

Star Shape



#include
#include
void main()
{
int i;
clrscr();
for(i=1;i<=5;i++)
printf("*****\n");
getch();
}

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