Posts

Showing posts from October, 2011

matrix multiplication 2nd

C matrix multiplication program #include<stdio.h> #include<conio.h>   main() { int m, n, p, q, c, d, k, sum = 0; int first[10][10], second[10][10], mul[10][10];   printf("Enter the number of rows and columns of first matrix \n "); scanf("%d%d",&m,&n); printf("Enter the elements of first matrix \n ");   for ( c = 0 ; c < m ; c++ ) for ( d = 0 ; d < n ; d++ ) scanf("%d",&first[c][d]);   printf("Enter the number of rows and columns of second matrix \n "); scanf("%d%d",&p,&q);   if ( n != p ) printf("Matrices with entered orders can't be multiplied with each other. \n "); else { printf("Enter the elements of second matrix \n ");   for ( c = 0 ; c < p ; c++ ) for ( d = 0 ; d < q ; d++ ) scanf("%d",&second[c][d]);   for ( c = 0 ; c < m ; c++ )

lab programs

LINEAR SEARCH USING C PROGRAM

#include <stdio.h> int   main (){ int  a[10],i,n,m,c=0; printf( "Enter the size of an array" ); scanf( "%d" ,&n); printf( "\nEnter the elements of the array" ); for (i=0;i<=n-1;i++){ scanf( "%d" ,&a[i]); } printf( "\nThe elements of an array are" ); for (i=0;i<=n-1;i++){ printf( " %d" ,a[i]); } printf( "\nEnter the number to be search" ); scanf( "%d" ,&m); for (i=0;i<=n-1;i++){ if (a[i]==m){ c=1; break ; } } if (c==0) printf( "\nThe number is not in the list" ); else printf( "\nThe number is found" ); return  0; }

reverse a String without using C functions ?

#include<stdio.h> #include<conio.h> #include<string.h> int main() { int i=0,l,l1; char str[100]; printf("enter string:"); scanf("%s",&str); while(str[i]) i++; l=i; for(i=0;i<=(l-1)/2;i++) { char t=str[i]; str[i]=str[l-i-1]; str[l-i-1]=t; } str[l]=0; printf("\n\nreversed string is:%d",str); getch(); return 0; }

C PROGRAM TO FIND SUM OF THREE NUMBERS UPDATED

#unclude<stdio.h> #include<conio.h> void main(); int a,b,c; int sum; void sum(); void read(); void display(); printf("enter the numbers one by one"); read(); printf("sum="); sum(); display(); read() { scanf("%d%d",&a,&b,&c); if(a==0) { printf("enter the number again"); scanf("%d",&a); } sum() { sum=a+b+c; } display() { printf("%d",sum); } getch(); }

SERIES EXAM

SERIES EXAM'S STARTED ON SATURDAY FIRST EXAM   DS DATA  STRUCTURE SECOND DAY MONDAY =     MATHS   THIRD DAY LAST EXAM OOP OBJECT ORIENTED PROGRAMMING             ........................................