Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
IGNOU MCA 2nd Semster Data Structure Lab Record Solved MCSL 025

IGNOU MCA 2nd Semster Data Structure Lab Record Solved MCSL 025



|Views: 8,262|Likes:
Published by fajer007
IGNOU MCA 2nd Semster Data Structure Lab Record Solved MCSL 025
IGNOU MCA 2nd Semster Data Structure Lab Record Solved MCSL 025

More info:

Published by: fajer007 on Jul 18, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as RTF, PDF, TXT or read online from Scribd
See more
See less





Product of two matrices
#include <stdio.h>#define MAX 10void main(){int a[MAX][MAX],b[MAX][MAX],c[MAX][MAX],i,j,k,m,n,p,q;clrscr(); printf("Enter the order of the first matrix\n");scanf("%d %d",&m,&n); printf("Enter the order of the second matrix\n");scanf("%d %d",&p,&q);if(n!=p){printf("The matrix can not be multiplied\n");}else{printf("Enter the elements of the first matrix\n");for(i=0;i<m;i++)for(j=0;j<n;j++)scanf("%d",&a[i][j]); printf("Enter the elements of the second matrix\n");for(i=0;i<p;i++)for(j=0;j<q;j++)scanf("%d",&b[i][j]);for(i=0;i<m;i++)for(j=0;j<q;j++){c[i][j]=0;for(k=0;k<n;k++)c[i][j]=c[i][j]+(a[i][k]*b[k][j]);} printf("The resultant matrix on multiplication is\n");for(i=0;i<m;i++){for(j=0;j<q;j++) printf("%d\t",c[i][j]); printf("\n");}}getch();}
Enter the order of the first matrix2 3
Enter the order of the second matrix3 2Enter the elements of the first matrix1 23 45 6Enter the elements of the second matrix1 2 34 5 6The resultant matrix on multiplication is22 2849 64
Program to accept 10 strings as input and print them in lexicographic order 
9.Start10.Enter 10 strings to an array of strings11.Set i = 0, repeat steps 4-7 until i=1012.Set j =i+113.If ‘i’ th string in the array is greater than ‘j’ th string, then inter-change them, using atemporary string variable.14.Increment j, repeat step 5,6 untill j> 1015.Increment i16.Print the strings17.Stop
#include<stdio.h>void main(){char str[10][10],t[10];int i,j;clrscr();for(i=0;i<10;++i)strcpy(str[i],""); printf("Enter the strings\n");for(i=0;i<10;++i)scanf("%s",str[i]);for(i=0;i<10;++i){for(j=i+1;j<10;++j)if(strcmp(str[i],str[j])>0)
{strcpy(t,str[i]);strcpy(str[i],str[j]);strcpy(str[j],t);}} printf("The strings in lexicographical order is\n");for(i=0;i<10;++i) printf("%s\n",str[i]);getch();}
Enter 10 stringsUma Kiran Reema Jeena Ram Veena Reva Sini Jaya AnuStrings in lexicographic order AnuJayaJeenaKiranRamReenaRevaSiniUma
Program that accept two strings S1, S2 as input and check if S2 is a substring of S1 or not. If so,then print the starting and ending location of S2 in S1. If S2 appear more than once in S1, thenlocation of all instances have to be given.
18.Start19.Enter a string (s1)20.Enter substring to test (s2)21.Find length , l1,l222.While i<l2 check ‘s2’ character by character till end of string (‘/0’) is reached, find thestart and end of the string23.If character found, increment i, else stop24.If start-0 print ‘s2’ is not a substring25.Stop
#include<stdio.h>#include<string.h>void main(){int i=0,j=0,v,c=0,l1,l2;

Activity (52)

You've already reviewed this. Edit your review.
Priti Yadav added this note
1 thousand reads
1 hundred reads
Hitesh Pahuja liked this
Hunny Topiwala liked this
Hitesh Pahuja liked this
Hitesh Pahuja liked this
Viral Dave liked this
Hasanen10 liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->