answersLogoWhite

0


Best Answer

# include<stdio.h> void display(int [][3]); void main() { int c; void func1(); void func2(); void func3(); void func4(); void func5(); clrscr(); printf("\n- : Matrix Manipulation Functions (for 3 X 3 Matrix) : -"); printf("\n-------------------------------------"); printf("\n Matrix Addition : 1"); printf("\n Matrix Subtraction : 2"); printf("\n Matrix Multiplication : 3"); printf("\n Find Transpose Matrix : 4"); printf("\n Matrix is Symmetric or not : 6"); printf("\n Enter Your Choice : "); scanf("%d",&c); switch(c) { case 1: func1(); break; case 2: func2(); break; case 3: func3(); break; case 4: func4(); break; case 5: func5(); break; default: printf("\nInvalid Choice"); } getch(); } void func1() { int x[3][3],y[3][3],z[3][3]; void getmatrix(int [][3]); void addition(int [][3],int [][3],int [][3]); clrscr(); getmatrix(x); getmatrix(y); addition(x,y,z); printf("\n - : Matrix 1: - \n"); display(x); printf("\n - : Matrix 2: - \n"); display(y); printf("\n - : Matrix Addition (Result): - \n"); display(z); } void getmatrix(int t[][3]) { int i,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("Enter element [%d][%d] : ",i,j); scanf("%d",&t[i][j]); } } } void addition(int p[][3],int q[][3],int r[][3]) { int i,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) r[i][j]=p[i][j]+q[i][j]; } } void func2() { int x[3][3],y[3][3],z[3][3]; void getmatrix(int [][3]); void subtraction(int [][3],int [][3],int [][3]); clrscr(); getmatrix(x); getmatrix(y); subtraction(x,y,z); printf("\n - : Matrix 1: - \n"); display(x); printf("\n - : Matrix 2: - \n"); display(y); printf("\n - : Matrix Subtraction (Result): - \n"); display(z); } void subtraction(int p[3][3],int q[3][3],int r[3][3]) { int i,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) r[i][j]=p[i][j]-q[i][j]; } } void func3() { int x[3][3],y[3][3],z[3][3]; void getmatrix(int [][3]); void multiplication(int [][3],int [][3],int [][3]); clrscr(); getmatrix(x); getmatrix(y); multiplication(x,y,z); printf("\n - : Matrix 1: - \n"); display(x); printf("\n - : Matrix 2: - \n"); display(y); printf("\n - : Matrix Multiplication (Result): - \n"); display(z); } void multiplication(int p[][3],int q[3][3],int r[3][3]) { int i,j,k; for(i=0;i<3;i++) //condition i< total row of matrix1 { for(j=0;j<3;j++) //condition i< total col of matrix1 or//condition i< total row of matrix2 { r[i][j]=0; for(k=0;k<3;k++) //condition i< total col of matrix2 r[i][j]=r[i][j]+(p[i][j]*q[j][k]); } } } void func4() { int x[3][3],y[3][3]; void getmatrix(int [][3]); void transpose(int [][3],int [][3]); clrscr(); getmatrix(x); transpose(x,y); printf("\n - : Matrix 1: - \n"); display(x); printf("\n - : Transpose Matrix : - \n"); display(y); } void transpose(int p[][3],int q[][3]) { int i,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) q[i][j]=p[j][i]; } } void func5() { int x[3][3],y[3][3]; void getmatrix(int [][3]); void transpose(int [][3],int [][3]); int symmetric(int [][3],int [][3]); clrscr(); getmatrix(x); transpose(x,y); if(symmetric(x,y)==1) printf("\nMatrix is Symmetric"); else printf("\nMatrix is Not Symmetric"); } int symmetric(int p[][3],int q[][3]) { int i,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) { if(q[i][j]!=p[i][j]) return 0; } } return 1; } void display(int m[][3]) { int i,j; printf("\n\n"); for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d ",m[i][j]); printf("\n"); } }

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c-program to simulate a simple calculator that performs addition subtraction multiplication and division of integers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic
Related questions

Why the float is used in cprogram?

It's one of the built-in data-types, a float-type variable can hold a floating-point number.


What is cprogram code to insert a node in single link list?

Write Code to Insert a Node in a Single Linked List at any given Position.


Unix cprogram based on dynamic memory allocation to find the minimum and maximum set of numbers?

#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main(){ int n,i,*ptr,sum=0; printf("Enter number of elements: "); scanf("%d",&amp;n); ptr=(int*)malloc(n*sizeof(int)); //memory allocated using malloc if(ptr==NULL) { printf("Error! memory not allocated."); exit(0); } printf("Enter elements of array: "); for(i=0;i&lt;n;++i) { scanf("%d",ptr+i); sum+=*(ptr+i); } printf("Sum=%d",sum); free(ptr); return 0; }


How Write a cprogram to find all the numbers divisible by 5and7 between 1to100?

To check for divisibility, use the "%" operator - the remainder of a division. If the remainder is 0, it is divisible.for (i = 1; i


How do you wirte a cprogram to merge two sorted singly linked list?

Merge Two Linked List...CheckExpand Post &raquo;I want to merge 2 linked list into 1.Is the code below ok? Can you Check please?C Syntax (Toggle Plain Text)LIST Merge_List(LIST P,LIST Q){HEADER h = P;NODEPTR ptr2 =Q;NODEPTR ptr1 = P;NODEPTR prev=P;NODEPTR temp=NULL;/* Second List Pointer */while(ptr2 != NULL){/* First List Pointer */while(ptr1 != NULL){while(ptr2->Age>ptr1->Age){prev = ptr1;ptr1 = ptr1->Next;}if(prev == ptr1){// This means the first node of the header needs to be changedtemp = New_Node();temp->Age = ptr2->Age;temp->Next = prev;prev = temp;h = temp;}else{temp = New_Node();temp->Age = ptr2->Age;temp->Next = prev->Next;prev->Next = temp;}break;}ptr2 = ptr2->Next;}return h;}


Cant reinstall gears of war when i installed my gears of war on the PC and when i launch he game an error occured it says Cprogram filesmicrosoft gamesbinarieswargameg4liveexe?

Well, I truly don't know what the hell you just said. Neither did the other guy.But, I can tell you that other ways of installing it are:* Downloading a Stand-Alone Version.* Uninstalling/Deleting the files(If you can, Uninstall it, if you don't I can't ensure your achievment)* Maybe you can download Steam? However, if you download it you WILL need a virus. DON'T LOOK AT ME WRONG, but it's a virus... and it slaves for you... it cannot deviate/go wrong, it never has, and never will.It's called Keygen.You may or may not have heard of it, but when I saw it was a virus, I FREAKED OUT.About 2 Years later, I idiotically tried it again... but when I discovered it was one that worked FOR you, I was quite impressed. Best of all... IT FREAKING WORKED!!!!!!!I've downloaded Adobe Flash Professional 9,Steam... (twice)Sony Vegas Pro 9,AudioSurf (it's actually kinda fun, you should try it! :D),and I even stole QuickTime Player 8 once, (I just never found out how I did it...)_______________________________________________________~PivotBrawler12(I'm on YouTube, BUT there's no need to subscribe, I WOULD like to know that I helped though.)


What do I do with the avg 8.5 resident shield warning every time I open internet explorer when the message refers to cprogram filesmywebsearchwbbar1binw6bardll?

You browser still got the mywebsearch malware You need to run these 3 essential programs to remove all the spyware on your computer. If you do not have an internet security suit and only an anti virus 1. Run Malwarebytes Anti-Malware 2. Run a complete scan with free curing utility Dr.Web CureIt! 3. Run the anti spyware removal programs spybot or Superantispyware * Browsers Use Mozilla firefox or the google chrome browser for browsing unsafe websites * Install ThreatFire ThreatFire, features innovative real-time behavioral protection technology that provides powerful standalone protection or the perfect complement to traditional signature-based antivirus programs offers unsurpassed protection against both known and unknown zero-day viruses, worms, trojans, rootkits, buffer overflows, spyware, adware and other malware. Run an online virus scan like * Trend Micro HouseCall * Kaspersky free online virus scanner * Windows Live OneCare safety scanner * BitDefender Online Scanner * ESET Online Antivirus Scanner * F-Secure Online Virus Scanner * avast! Online Scanner update your software by running * Secunia Online Software Inspector


Using do while statement write cprogram for factorial number?

The program goes as follows:#include#includevoid main(){int i, j=1;printf("Enter the value of the integer whose factorial has to be calculated");scanf("%d",i);while(ji = i*(i-1);i--;printf("The factorial of the integer is:%d",i);getch();}OTHER METHOD.............#include#includevoid main(){int n,f;f=1;printf("Enter the number:\n");scanf("%d",&n);while(n>0){printf("%d",n);f=f*n;n--;}printf("The factorial of the integer is:%d",f);getch();}another methodA very easy method,,,,,,these is the work of 2nd year high school programming........... CVHS..#include int main(){char m;int ans, i, n;i=0;m='y';while((m=='y')(m=='Y')){coutn;if(n==0){ans=1;cout