Nested Loop in c

loop inside another loop is called nested loop. This is used ,where multiple conditions with complexity are there and those cannot be done by the logical operators. Mostly this nested loops are used in multi-dimensional arrays,we will see syntax of nested-if loop

syntax:

if (test condition)
{
if (test condition)
{
statement(s);
}
statement(s);
}
#include
int main()
{
int salary;
float bonus,net;
char dept;
salary=bonus=net=0;
printf("enter department");
scanf("%1c",&dept);
printf("enter slary");
scanf("%d",&salary);
if(dept=='M'||'m')
{
if (salary>2000)
{
bonus=salary*20/100;
}
else
{
bonus=salary*10/100;
}
}
net=salary+bonus;
printf("salary \n %5.2f",net);
}

output:

enter department =m
enter slary = 1000
bonus salary
1100.00