Advertisement
adesuryadi_

TAI 1

Apr 2nd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3.  
  4. void main()
  5. {
  6. int b,k;
  7. int A[5][5],B[5][5],C[5][5];
  8.  
  9. //Matriks A
  10. for(b=0;b<3;b++)
  11. {
  12. for(k=0;k<3;k++)
  13. {
  14. cout<<" Matiks A Baris " <<(b+1)<<"."<<(k+1)<<" : ";
  15. cin>>A[b][k];
  16. } cout<<endl;
  17. }cout<<endl;
  18.  
  19. //Matriks B
  20. for(b=0;b<3;b++)
  21. {
  22. for(k=0;k<3;k++)
  23. {
  24. cout<<" Matiks B Baris " <<(b+1)<<"."<<(k+1)<<" : ";
  25. cin>>B[b][k];
  26. } cout<<endl;
  27. }
  28. clrscr();
  29.  
  30. //Rumus Penjumlahan
  31. for(b=0;b<3;b++)
  32. {
  33. for(k=0;k<3;k++)
  34. {
  35. C[b][k]=A[b][k]+B[b][k];
  36. }
  37. }
  38.  
  39. //cetak Matiks A
  40. cout<<" Matriks A \n";
  41. for(b=0;b<3;b++)
  42. {
  43. for(k=0;k<3;k++)
  44. {
  45. cout<<A[b][k]; cout<<"\t";
  46. } cout<<endl;
  47. }
  48.  
  49. //Cetak Matriks B
  50. cout<<" Matriks B \n";
  51. for(b=0;b<3;b++)
  52. {
  53. for(k=0;k<3;k++)
  54. {
  55. cout<<B[b][k]; cout<<"\t";
  56. } cout<<endl;
  57. }
  58.  
  59. //Cetak Matriks C
  60. cout<<"===========================\n";
  61. cout<<" Matriks C \n";
  62. for(b=0;b<3;b++)
  63. {
  64. for(k=0;k<3;k++)
  65. {
  66. cout<<C[b][k]; cout<<"\t";
  67. } cout<<endl;
  68. }
  69.  
  70.  
  71. getch();
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement