/*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(); } }
there is some good c ,java, sql and vb6 programs,Windows tricks, sms shorthand etc
#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(); } }
#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(); }
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(); } }
'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