# C Programming – HackerRank Solution | 2D ARRAYS- Lockdown Salary |

### (HackerRank) Write a Modular C Programming code to solve 2D ARRAYS- Lockdown Salary, Zanfi Systems is a software development Multi National Company. It has offices in different countries

Zanfi Systems is a software development Multi National Company. It has offices in different countries. Due to Lockdown and slow work progress, the company deducted 30% salary of all the employees. Consider there are N employees in M offices, based on actual salary, the lockdown salary of each employee after deduction is computed by the Human Resource Manager.

Apply a problem-solving framework and write a modular C program to determine the lockdown salary.

Input Format

First line is M – indicates a number of offices and N – indicates number of employees.

Second line onwards is salary of every employee in all the offices.

Constraints

10000 <= salary <= 100000

Output Format

Salary of every employee after deduction.

Sample Input 0

```2 5
35500 42000 33000 55000 62000
45000 23000 22000 12000 59000
```

Sample Output 0

```Salary after deduction:
24850 29400 23100 38500 43400
31500 16100 15400 8400 41300
```

Sample Input 1

```4 4
55000 40000 39000 56000
41000 29000 88000 72000
58000 29000 27000 15000
65000 83000 62000 87000
```

Sample Output 1

```Salary after deduction:
38500 28000 27300 39200
28700 20300 61600 50400
40600 20300 18900 10500
45500 58100 43400 60900```

CODE:

```#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main() {
int offices,employees,i,j;
scanf("%d%d",&offices,&employees);
printf("Salary after deduction:\n");
int salary[offices][employees];
for(i=0;i<offices;i++)
{
for(j=0;j<employees;j++)
{
scanf("%d",&salary[i][j]);
printf("%d ",70*salary[i][j]/100);
}
printf("\n");
}
return 0;
}

```

OUTPUT

```Congratulations, you passed the sample test case.

Click the Submit Code button to run your code against all the test cases.

Input (stdin)

2 5
35500 42000 33000 55000 62000
45000 23000 22000 12000 59000
Your Output (stdout)

Salary after deduction:
24850 29400 23100 38500 43400
31500 16100 15400 8400 41300
Expected Output

Salary after deduction:
24850 29400 23100 38500 43400
31500 16100 15400 8400 41300```

Please find some more codes of Loops, Condition Statements, 1D Arrays, 2D Arrays, Strings, Pointers, Data Structures, Files, Linked lists, Stacks, Queues, Binary Trees, MISC, Solved model question papers & Hacker Rank all solutions on the below page:

Top 100+ C Programming codes – KLE Technological University

#### Welcome to FactsPrime

Sorry, We have detected that you have activated Ad-Blocker. Please Consider supporting us by disabling your Ad Blocker, It helps us in maintaining this website. To View the content, Please disable adblocker and refresh the page.

Thank You !!!