[c] 9th

Viewer

  1. // Online C compiler to run C program online
  2. #include <stdio.h>
  3.  
  4. int main() {
  5.     // Write C code here
  6.     int recv[3][4];
  7.     
  8.     int sum = 0, carry = 0;
  9.     for (int i=0;i<3;i++){
  10.         for(int j=0;j<4;j++)
  11.             scanf("%d", &recv[i][j]);
  12.     }
  13.     int res[5] = {0};
  14.     for(int j=3;j>=0;j--)
  15.         for (int i=0;i<3;i++){
  16.             res[j+1] += recv[i][j];
  17.         if (res[j+1] >= 10){
  18.             res[j+1] -= 10;
  19.             res[j] +=1;
  20.         }
  21.     }
  22.     printf("Code word is :\n");
  23.     for (int i=0;i<5;i++)
  24.         printf("%d ", res[i]);
  25.     
  26. }

Editor

You can edit this paste and save as new:


File Description
  • 9th
  • Paste Code
  • 15 Jun-2021
  • 588 Bytes
You can Share it: