Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Record manual 45-55 programs for ECE-A and ECE-B

Record manual 45-55 programs for ECE-A and ECE-B

Ratings: (0)|Views: 18|Likes:
Published by ashu reddy

More info:

Published by: ashu reddy on Mar 30, 2008
Copyright:Attribution Non-commercial

Availability:

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

05/08/2014

pdf

text

original

 
45)Transpose of a matrix and test for symmetry
#include<stdio.h>#include<conio.h>void main(){int i,j,row1,row2,col1,col2,a[10][10],b[10][10];clrscr();printf("\nEnter order of matrix a");scanf("%d%d",&row1,&col1);printf("\nEnter the elements of matrix A:\n");for(i=0;i<row1;i++)for(j=0;j<col1;j++)scanf("%d",&a[i][j]);for(i=0;i<row1;i++){for(j=0;j<col1;j++){printf("\t%d",a[i][j]);}printf("\n");}row2=col1;col2=row1;for(i=0;i<row1;i++)for(j=0;j<col1;j++)b[j][i]=a[i][j];printf("\n The matrix transpose is\n");for(i=0;i<row2;i++){for(j=0;j<col2;j++)printf("%4d",b[i][j]);printf("\n");}getch();}
 
47)Demonstrate dynamic memory management functions
#include<stdio.h>#include<conio.h>#include<alloc.h>void main(){int i,sum=0,*p,x,y,*q,s=0;clrscr();printf("\n Enter number of elements in array p:");scanf("%d",&x);p=(int*)malloc(x*2);q=(int*)calloc(y,2);printf("\n Enter Elements of array p:");for(i=0;i<x;i++){printf("\n %d Element:",i+1);scanf("%d",&p[i]);}for(i=0;i<x;i++){sum=sum+p[i];}printf("\n Enter number of elements in array q:");scanf("%d",&y);printf("\n Enter elements of array q:");for(i=0;i<y;i++){printf("\n%d Element:",i+1);scanf("%d",&q[i]);}for(i=0;i<y;i++){s=s+q[i];}printf("\nSum of all elements in array p=%d",sum);printf("\n Sum of all elements in array q:%d",s);getch();}
 
48) Define a structure type ABS, that containsname,age,destination and salary.Using this structure, write aprograme to read this information for one person from thekeyboard and print the same on screen.
#include<stdio.h>#include<conio.h>struct ABS{char name[100];int age;char designation[100];float salary;};int main(){struct ABS person;clrscr();printf("\n Enter the name:");gets(person.name);printf("\n Enter the designation:");gets(person.designation);printf("\n Enter the age:");scanf("%d",&person.age);printf("\n Enter salary:");scanf("%f",&person.salary);printf("\n***********************************************************");printf("\n Person Details:");printf("\n***********************************************************");printf("\nName:%s\tAge:%d\nDesignation:%s\tSalary:%f",person.name,person.age,person.designation,person.salary);getch();return 0;}

You're Reading a Free Preview

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