fork download
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int i,j,choice;
  6. int a[3][3],b[3][3],c[3][3];
  7.  
  8. printf("Enter the value of a[3][3]=\t");
  9. for(i=0;i<3;i++){
  10. for(j=0;j<3;j++)
  11.  
  12. scanf("%d",&a[i][j]);}
  13. printf("Enter the value of b[3][3]=\t");
  14.  
  15. for(i=0;i<3;i++){
  16. for(j=0;j<3;j++)
  17. scanf("%d",&b[i][j]);
  18. }
  19. printf("What is your choice?\n");
  20. printf("1.addition\n2.subtraction\n");
  21. printf("Enter choice(press 1 or 2) : ");
  22. scanf("%d",&choice);
  23. printf(("c[3][3]=\n"));
  24. if(choice==1){
  25. for(i=0;i<3;i++){
  26. for(j=0;j<3;j++){
  27. c[i][j]=a[i][j]+b[i][j];
  28. printf(" %d\t",c[i][j]);
  29. }
  30. printf(" \n");
  31. }
  32. }
  33. else{
  34. for(i=0;i<3;i++){
  35. for(j=0;j<3;j++){
  36. c[i][j]=a[i][j]-b[i][j];
  37. printf(" %d\t",c[i][j]);
  38. }
  39. printf(" \n");
  40. }
  41. }
  42.  
  43.  
  44.  
  45. return 0;
  46. }
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
Success #stdin #stdout 0s 2172KB
stdin
Standard input is empty
stdout
Enter the value of a[3][3]=	Enter the value of b[3][3]=	What is your choice?
1.addition
2.subtraction
Enter choice(press 1 or 2) : c[3][3]=
    -1433768899	    134513396	    1433120620	    
    622738	    -135137741	    622738	    
    -48	    -134519276	    1298482402