Thursday 5 July 2012

Basic C Programming009

A cashier has currency notes of denominations Ten, Fifty and Hundred. If the amount to be withdrawn is input through the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to give to the withdraw.  


#include <stdio.h>
#include <conio.h>
void main ( )
{
           int rs, ten, fifty, hun, x, y;
           clrscr ( );
 
           printf("\n Enter amount to withdrawn..:"); scanf("%d",&rs);

           hun = rs / 100;
           x = rs % 100;
           fifty = x / 50;
           y = x % 50;
           ten = y / 10;

           printf("\n\n %d Hundred rupees notes\n\n %d Fifty rupees notes\n\n %d Ten
                        rupees notes",hun,fifty,ten);
           getch ( );
}

Click here to contact us

If the total selling price of fifteen items and the total profit entered on them is input through the keyboard, write a program to fined the cost price of one item.


#include <stdio.h>
#include <conio.h>
void main ( )
{
          float               sprice, tprofit, cprice;
          clrscr( );
        
          printf("\n Selling price of 15 itens..:Rs."); scanf("%f",&sprice);
printf("\n Enter total profit..:Rs."); scanf("%f",&tprofit);

          cprice = (sprice-tprofit)/15;

printf("\nCost price of one item=Rs.%.2f",cprice);
          getch ( );
}

Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...