Earn by twitter on twivert

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

Saturday, May 29, 2010

To find out 2D matrix addition


/*To find out 2D matrix addition*/
/*Save file as: Matrix_Additon.java*/

import java.lang.*;
class Matrix
{
        int l[][],m[][],n[][];
        Matrix()
        {
        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[3][3];
        }
        void display()
        {
        for(int i=0;i<3;i++)
        {
        for(int j=0;j<3;j++)
        {
  n[i][j]=l[i][j]+m[i][j];        
   System.out.print("  "+n[i][j]);
                
        }
                System.out.println(" ");
        }
        }
}
class Matrix_Additon
{
        public static void main(String arg[])
        {
        Matrix a1=new Matrix();
        a1.display();
 }
}

WAP to open and close a file


/*WAP to open and close a file*/

#include
#include
void main()
{
char ch;
int i;
clrscr();
FILE *fptr;
fptr=fopen("file1.dat","w");
printf("\nenter 5 character:\n");
for(i=0;i<=5;i++)
{
ch=getchar();
fputc(ch,fptr);
}
fclose(fptr);
printf("\nreading form file & print on screen\n");
fptr=fopen("file1.dat","r");
while(!feof(fptr))
{
ch=getc(fptr);
putchar(ch);
}
fclose(fptr);
getch();
}

Tuesday, May 18, 2010

Talking machine


Talking machine


1. Open notepad and paste the following code :

Dim msg, sapi
msg=InputBox("Enter your text","Talking machine")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak msg

2. save the file with .vbs extension,
   Example: TextSpeech.vbs 

   it will create a VBScript File.

3. Double click on TextSpeech.vbs file 
4. input the text and press ok and listen.”

Saturday, May 15, 2010

Upper Case To Lower Case




'controls       Property        Setting

'Label1          Name            lbl
'                Caption          Enter Text

'Textbox1        Name            Text1
'                Caption           -

'Label2          Name            lblUpper
'                Caption          -

'Label3          Name            lblLower
'                Caption          -

'Label4          Name            lblReverse
'                Caption          -

'command1        Name            cmdUpper
'                Caption           Upper

'command2        Name            cmdLower
'                Caption           Lower

'command3        Name            cmdReverse
'                Caption           Reverse


'-----------------------------------------------------
'                        CODE

Private Sub cmdUpper_click()

text=Ucase(Text1.text)
lblUpper.Caption=text
End Sub

Private Sub cmdLower_click()

text=LUcase(Text1.text)
lblLower.Caption=text
End Sub

Private Sub cmdReverse_click()

text=StrReverse(Text1.text)
lblReverse.Caption=text
End Sub

WAP to multiplication of 2 matrix


/*WAP to multiplication of 2 matrix*/

#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],b[2][2],c[2][2],i,j,k;
clrscr();
printf("enter 1 matrix");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter 2 matrix");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=0;
for(k=0;k<2;k++)
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
printf("multiplication of 2 matrix");
for(i=0;i<2;i++)
{
printf("\n");
for(j=0;j<2;j++)
{
printf("%d\t",c[i][j]);
}
}
getch();
}

Saturday, May 8, 2010

Pascal shape


/*Pascal shape*/

#include<stdio.h>
#include<conio.h>
main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=i;j<5;j++)
printf(" ");
for(j=1;j<=2*i-1;j++)
printf("*");
printf("\n");
}
getch();
}

Friday, May 7, 2010

WAP check highest or lowest array element


/*WAP check highest or lowest array element*/

#include<stdio.h>
#include<conio.h>
void main()
{
int array[5],min,max,i;
clrscr();
printf("enter value of array");
for(i=1;i<=5;i++)
scanf("%d",&array[i]);
min=max=array[0];
for(i=1;i<=5;i++)
{
if(array[i]>min)
max=array[i];
else
if(array[i]<max)
min=array[i];
}
printf("\nhighest element is: %d\n",max);
printf("\nlowest element is: %d\n",min);
getch();
}

Wednesday, May 5, 2010

wap to display series 2,4,6,8,10 using "for loop"


/*wap to display series 2,4,6,8,10 using "for loop"*/

#include<stdio.h>
#include<conio.h>
void main()
{
int i,n=2,ser;
clrscr();
for(i=1;i<=5;i++)
{
ser=n*i;
printf("\n%d",ser);
getch();
}
}

Sunday, May 2, 2010

To display student record’s thrg inheri


/*To display student record’s thrg inheri*/
/*Save as: inherited*/

import java.lang.*;
class Student_information
{
   int id;
   String name,addr;
   Student_information(int id,String name,String addr)
     {
     this.id=id;
     this.name=name;
     this.addr=addr;
     }
   void display()
     {
     System.out.println("information of student");
     System.out.println("id"+id);
     System.out.println("name"+name);
     System.out.println("address"+addr);
     }
}
class Student_record extends Student_information
{
   String branch,sem;
   Student_record(int id,String name,String addr,String branch,String sem)
   Super(id,name,addr);
   {
   this.branch=branch;
   this.sem=sem;
   }
   void display()
   {
   display();
   System.out.println("student record");
   System.out.println("branch"+branch);
   System.out.println("sem"+sem);
   }
}
class inherited
{
    public static void main(String args[])
      {
      Student_record s1=new Student_record(47,"student A","har","bca","second");
      Student_record s2=new Student_record(49,"student B","mah","bca","second");
      Student_record s3=new Student_record(11,"student C","delhi","cs","third");
      
      s1.display();
      s2.display();
      s3.display();
      
      }
}

WAP to display day name according to enter number


/*WAP to display day name according to enter number*/

#include<stdio.h>
#include<conio.h>
void main()
{
int day;
clrscr();
printf("enter no.");
scanf("\n%d",&day);
switch(day)
{
case 1:printf("monday");
break;
case 2:printf("tuesday");
break;
case 3:printf("wednesday");
break;
case 4:printf("thusday");
break;
case 5:printf("friday");
break;
case 6:printf("satarday");
break;
case 7:printf("sunday");
break;
default:printf("No Day");
}
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