Earn by twitter on twivert

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

Thursday, April 15, 2010

WAP to calculat factorial using "for loop"


/*WAP to calculat factorial using "for loop" */

#include<stdio.h>
#include<conio.h>
void main()
{
int fact=1,n,i;
clrscr();
printf("enter number");
scanf("%d",&n);
for(i=1;i<=n;i++)
fact=fact*i;
{
printf("%d",fact);
getch();
}
}

WAP to calculat factorial using "WHILE" loop


/*WAP to calculat factorial using "WHILE" loop"*/

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i=1,fact=1;
clrscr();
printf("enter no.");
scanf("%d",&n);
while(i<=n)
{
fact=fact*i;
i++;
}
printf("%d",fact);
getch();
}

WAP To print Subtraction of array elements


/*WAP To print Subtraction of array elements*/
/*Save file as: Array_Subtraction.java*/

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_Subtraction
{
        public static void main(String arg[])
        {
        Array a1=new Array();
        a1.display();
 }
}

WAP of Addition,Subtraction,Multiplycation


WAP of Addition,Subtraction,Multiplycation...

'controls       Property        Setting

'Textbox1        Name            Text1
 '               Caption           -

'Textbox2        Name            Text2
   '             Caption           -

'Label1          Name            Lebel1
  '              Caption          Enter first number

'Label2          Name            Lebel2
   '             Caption           enter second number

'Label3          Name            Lebel3
    '            Caption           Result

'command1        Name            command1
 '               Caption         Addition
          
'command2        Name            command2
 '               Caption         Subtraction
           
'command3        Name            command3
 '               Caption         Multiplication
           
'command4        Name            command4
'                Caption         Dividetion

'command5        Name            command5
'                Caption         Mod
'----------------------------------------------------------
'                      Code
Dim a as Integer
Dim b as Integer
Dim c as Integer

Private Sub command1_click()
a=Val(Text1.text)
a=Val(Text2.text)
c=a+b
Lebel3=c
End Sub

Private Sub command2_click()
a=Val(Text1.text)
a=Val(Text2.text)
c=a-b
Lebel3=c
End Sub

Private Sub command3_click()
a=Val(Text1.text)
a=Val(Text2.text)
c=a*b
Lebel3=c
End Sub

Private Sub command4_click()
a=Val(Text1.text)
a=Val(Text2.text)
c=a/b
Lebel3=c
End Sub

Private Sub command5_click()
a=Val(Text1.text)
a=Val(Text2.text)
c=aModb
Lebel3=c
End Sub

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