-->

A program to get marks of any 5 subjects and to get total marks with percentage and division.

//Write a program to get marks of any 5 subjects and to get total marks with percentage and division.
#include<stdio.h>
#include<conio.h>
void main()
{
int marks_english,marks_math,marks_account,marks_cscience,marks_economics;
int total_marks;
float percentage;
printf("enter marks of all subjects \n");
printf("enter marks for english\n");
scanf("%d",&marks_english);
printf("enter marks for mathematics\n");
scanf("%d",&marks_math);
printf("enter marks for account\n");
scanf("%d",&marks_account);
printf("enter marks for cscience\n");
scanf("%d",&marks_cscience);
printf("enter marks for economics\n");
scanf("%d",&marks_economics);
if(marks_english>=40 && marks_math>=40 && marks_account>=40 && marks_cscience>=40 && marks_economics>=40)
  {
     printf("u have passed!!\n and \n");
      total_marks=marks_english+marks_math+marks_account+marks_cscience+marks_economics;
      percentage=(float) total_marks/5;
       if(percentage>=75)
           {
               printf("you have got %f percentage with distinction!!\n",percentage);
            }
      elseif(percentage>=60 && percentage<75 )
           {
               printf("you have got %f percentage with first division!!\n",percentage);
            }
      elseif(percentage>=55 && percentage<60 )
           {
               printf("you have got %f percentage with second division!!\n",percentage);
            }
       elseif(percentage>=40 && percentage<55 )
           {
               printf("you have got %f percentage with third division!!\n",percentage);
            }
   }
    
else
 {
printf("sorry, you have failed the exam.\n"); 
 printf("so there is no total and percentage with division for you.\n Try hard next time.\n");   
  } 
printf("thank you!!!!\n");
getch();
}

Write a program to read annual salary of an employee and decide tax withheld as follows.

//Write a program to read annual salary of an employee and decide tax withheld as follos.
//         salary                                          tax
//            <=100000                                0%
//           upto 150000                              15%
//          above 150000                             25%
#include<stdio.h>
#include<conio.h>
void main()
{
float annual_salary;
float total_tax;
printf("enter total annual salary \n");
scanf("%f",&total_sales);
if(annual_salary<=100000)
    {
         total_tax=0; 
         printf("total tax to be paid=Rs. 0\n");
    }
elseif(annual_salary>100000 &&annual_salary<=150000)
    {
         total_tax=annual_salary*0.15
         printf("total tax to be paid=Rs. %f\n",total_tax);
    }
elseif(annual_salary>150000)
    {
          total_tax=annual_salary*0.25
          printf("total tax to be paid=Rs. %f\n",total_tax);
    } 
printf("thank you!!!!\n");
getch();
}

Write a program to input cost price and selling price and determine whether there is loss or profit.

//Write a program to input cost price and selling price and determine whether there is loss or profit.
#include<stdio.h>
#include<conio.h>
void main()
{
float selling_price,cost_price;
printf("enter cost price \n");
scanf("%f",&cost_price);
printf("enter selling price \n");
scanf("%f",&selling_price);
if(selling_price>cost_price)
    {
          printf("there is profit\n");
          printf(" and profit is=%f\n",selling_price-cost_price);
    }
  else
    {
         printf("there is loss");
         printf(" and loss is=%f\n",cost_price-selling_price);

      }
printf("thank you!!!!\n");
getch();
}

Write a program to read age of person and find out the category among following according to age.

//Write a program to read age of person  and find out the category among following according to age.
//           category                                         age
//            child                                            0 to 12
//            teenage                                         13 to 19
//           adult life                                      20 to 30
//           mature life                                   31 to 50
//          old age                                         over 50

#include<stdio.h>
#include<conio.h>
void main()
{
float age_person;
printf("enter your age \n");
scanf("%f",&age_person);
if(age_person>=0 && age_person<=12)
    {
          printf("Your are child\n");
    }
elseif(age_person>12 && age_person<=19)
    {
          printf("Your are teenage\n");
    }
elseif(age_person>19 && age_person<=30)
    {
          printf("Your are in adult life\n");
    }    
elseif(age_person>30 && age_person<=50)
    {
          printf("Your are passing your mature life now\n");
    }
elseif(age_person>50)
    {
          printf("Your are now an old person\n");
    }
printf("thank you!!!!\n");
getch();
}

A company pays its employee on hourly basis.If an employee works for 8hrs hours he gets 100/hr and 120/hr for additional hours.Write a program to read working hours of an employee and calculate total salary.

//A company pays its employee on hourly basis.If an employee works for 8hrs hours he gets  100/hr
//and 120/hr for additional hours.
//Write a program to read working hours of an employee and calculate total salary.
#include<stdio.h>
#include<conio.h>
void main()
{
float total_working_hrs,extra_hrs;
float total_salary;
printf("enter your total working hours \n");
scanf("%f",&total_working_hrs);
if(total_working_hrs<=8)
    {
           total_salary=total_working_hrs*100
          printf("total salary=Rs. %f\n",total_salary);
    }
elseif(total_working_hrs>8)
    {
         extra_hrs=total_working_hrs-8;
          total_salary=extra_hrs*120+8*100;
         printf("the total salary earned=%f\n",total_salary);
      }

getch();
}


A program to display name of day on the basis of entered number . for example, 2 for Monday.

//Write a program to display name of day on the basis of entered number.
//. for example, 2 for Monday.                        
#include<stdio.h>
#include<conio.h>
void main()
{
int choice;
printf("enter number for day\n");
scanf("%d",&choice);
 switch(choice)
          {
                  case 1:
                            printf("Today is Sunday\n");
                           
                 break;
               case 2:
                            printf("Today is Monday\n");
                           
                 break;

               case 3:
                            printf("Today is Tuesday\n");
                           
                 break;
            case 4:
                            printf("Today is Wednesday\n");
                           
                 break;
            case 5:
                            printf("Today is Thursday\n");
                           
                 break;
           case 6:
                            printf("Today is Friday\n");
                           
                 break;


           case 7:
                            printf("Today is Saturday\n");
                           
                 break;
          default:
                            printf("sorry, not a valid input(beyond 7!!!!\n");
                            printf("thank u, terminating....\n");
          }
getch();
}

note:
here, you can use 'char' data type instead 'int' and you can input data before switch statement as well.
                                           

A company provides commission on the basis of total sales. Find commission.

//A company provides commission on the basis of total sales as follows.
 //        sales<10000-------------------------------->no commission
 //        sales >=10000 and <100000------------->5% commission
 //         sales>100000                  ---------------->10%commission
#include<stdio.h>
#include<conio.h>
void main()
{
float total_sales;
float total_commission;
printf("enter total sales \n");
scanf("%f",&total_sales);
if(total_sales<10000)
    {
          printf("total commission=Rs. 0\n");
    }
elseif(total_sales>=10000 && total_sales<=100000)
    {
         total_commission=total_sales*0.05;
         printf("the amount=%f\n",total_commission);
      }
elseif(total_sales>100000)
    {
        total_commission=total_sales*0.1;
         printf("the amount=%f\n",total_commission);
      }    
printf("thank you!!!!\n");
getch();
}