Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
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:

### Availability:

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;}