-->

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();
}

A program to get greatest value among three numbers using nested if.

//Write a program to get greatest value among three numbers using nested if.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int x,y,z;
printf("enter  numbers\n");
scanf("%d%d%d",&x,&y,&z);
if(x>y)
{
            if(x>z)
            {
       printf("x is greatest");
            }
           else
          {
             printf("z is greatest\n");
          }
}
else

{
    if(y>x)
     {
     if(y>z)
        {
                printf("y is greatest");
         }
       else
      {
      printf(" z is greatest");
      }
   }
   else
   {
   printf("x is greatest");
   }
}
getch();
}                                                                                                      

A book store gives 10% discount to a buyer if the buyer buys books more than Rs 1000.Write a program to asking the cost of books and calculate discount amount.

//A book store gives 10% discount to  a buyer if the buyer buys books more than Rs 1000.Write a //program to asking the cost of books and calculate discount amount.
#include<stdio.h>
#include<conio.h>
void main()
{
float total_books_amount_bought;
float discount_amount;


printf("enter total books' amount purchased\n");
scanf("%f",&total_books_amount_bought);
if(total_books_amount_bought<1000)
    {
          printf("sorry, no discount we have for this much amount!\n")
     }
else(total_books_amount_bought>1000)
    {
         discount_amount=total_books_amount_bought-total_books_amount_bought*0.1;
         printf("the discount amount=%f\n",discount_amount);
      }   

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

Write a program to read time in hours and displays different message

//Write a program to read time in hours and displays following message.
//       0 to 12                                                        Good morning
//        12 to 18                                                     Good evening
//        18 to 24                                                     Good night
#include<stdio.h>
#include<conio.h>
void main()
{
float time;
printf("enter value time in 24 hr format\n");
scanf("%f%",&time);
if(time>=0 && time<=12)
{
printf(Good morning man!!!\n");
}
elseif(time>12 && time<=18)
{
printf(Good evening man!!!\n");
}
elseif(time>18 && time<=24)
{
printf("good night");
}
getch();
}                                                                                                                 
            

a program to calculate roots of quadratic equation (ax2+bx+c).

//calculate roots of quadratic equation (ax2+bx+c). Conditions to be taken into account are
// (b2-4ac)>0 and 2a>0
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c;
float x1,x2;
float root_value;
printf("enter value for a,b and c\n");
scanf("%f%f%f",&a,&b,&c);
root_value=pow(b,2)-4*a*c;
if(root_value>0 && a>0)
{
printf("roots are possible\n");
x1=(-b+sqrt(root_value))/2*a;
x2=(-b+sqrt(root_value))/2*a;
printf("first root/value=%f\n",x1);
printf("second root/value=%f",x2);
}
else
{
printf("real roots are not possible\n instead,");
printf("imaginary roots are possible");
}
getch();
}