-->

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

a program to add two times in the format of hrs:minutes:seconds

// a program to add two times.
// e.g.
 // 2:50:20+2:40:12=5:30:32

#include<stdio.h>
#include<conio.h>
void main()
{
int hrs1,mns1,secs1;
int hrs2,mns2,secs2;
int hrs,mns,secs;
int real_hrs,real_mns,real_secs;
printf("enter first time\n");
printf("enter first hrs\n");
scanf("%d",&hrs1);
printf("enter minutes\n");
scanf("%d",&mns1);
printf("enter seconds now\n");
scanf("%d",&secs1);
printf("------------------\n");
printf("enter second time\n");
printf("enter first hrs\n");
scanf("%d",&hrs2);
printf("enter minutes\n");
scanf("%d",&mns2);
printf("enter seconds now\n");
scanf("%d",&secs2);
secs=secs1+secs2;
if(secs<60)
   {
     real_secs=secs1+secs2;
  }
else if(secs>=60)
   {
     real_mns=secs/60;
     real_secs=secs%60;
   }
mns=mns1+mns2;
if(mns<60)
   {
     real_mns=real_mns+mns1+mns2;
  }
else if(mns>=60)
   {
     hrs=mns/60;
     real_mns=mns%60;
   }
real_hrs=hrs1+hrs2+hrs;
printf("hrs=%d\n",real_hrs);
printf("minutes=%d\n",real_mns);
printf("seconds=%d\n",real_secs);
getch();
}

Write a 'C' program to get total amount for used Nepal telecom calls

//Nepal telecom calculates the bill according to following rule.
//minimum charge is Rs. 100 for 100 calls.
//if calls exceed 100 then charge is Rs. 1/call is added with 10% tax and 13% vat cumulatively on total amount. Write a 'C' program for this.

#include<stdio.h>
#include<conio.h>
void main()
{
float total_call,extra_call;
float initial_call=0;
float total_amount;

printf("enter total calls used\n");
scanf("%f",&total_call);
if(total_call<=100)
    {
          printf("total amount to be paid=Rs. 100\n");
    }
elseif(total_call>100)
    {
         extra_call=total_call-100;
          while(initial_call<=extra_call)
          {
           initial_call++:
         total_amount=1+initial_call*0.1+initial_call*0.13;
          }
 
         printf("the total amount=%f\n",total_amount);
      }  
}
printf("thank you!!!!\n");
getch();
}