by Dinesh Thakur Category: C Programming (Pratical)

This is C program that asks user to find out the discount against salary. User declares the variables for storing the value in it. Here user asks to put the basic salary for finding out the discount against salary. For this procedure user declares the nested if-else condition. if(a==1000) then the discount will be 200 and if a=1500 then 500 and at the else condition no discount will be printing on the screen a s result as per. Here nested if-else condition comes into the lime light.

Problem Statement:

This is C program that asks user to find out the discount against the salary.

  1. Declaring the variables.
  2. Using if-else condition.
  3. Display result on the screen.

Here is C source code for calculate the discount against the salary. Output of this program shown below. 

#include<stdio.h>

void main()
{
      int a,discount;
      clrscr();
      printf("Enter Basic Salary :");
      scanf("%d",&a);
      if(a==1000)
        {
            discount=200;
            printf("Discount : %d",discount);
        }
      else if(a==1500)
       {
           discount=500;
           printf("Discount : %d",discount);
       }
     else if(a==2500)
      {
          discount=700;
          printf("Discount : %d",discount); 
      }
    else
     {
          printf("No Discount");
     }
          getch();

Find The Discount Against Salary

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content