Calculate No. of Notes: Denominations 10, 50, and 100 in Given Amount

  • Thread starter Thread starter mkbh_10
  • Start date Start date
AI Thread Summary
The discussion revolves around a programming issue related to calculating the number of currency notes of denominations 10, 50, and 100 from a given amount. The user encounters an error when entering the amount, despite the program compiling successfully. The problem is identified in the `scanf` function, where the correct syntax should include the address operator `&` before the variable `p`. The correct line should be `scanf("%d", &p);`. Additionally, there are logical errors in the calculations for determining the number of notes, as the current formulas do not accurately compute the number of each denomination based on the input amount.
mkbh_10
Messages
217
Reaction score
0
I am using this program to calculate the no. of notes of denomination 10,50&100 in a given amount but i am getting error as soon as i enter the amount ?

#include<stdio.h>
#include<conio.h>

main ()
{
int a,b,c,a1,b1,c1;
int p;

printf ("enter the amount to be withdrawn Rs p \n");

scanf(" %d",p);

a=10;
b=50;
c=100;


a1= p-(b+c)/a;
b1= p-(a+c)/b;
c1= p-(a+b)/c;



printf("the number of notes of type a1 = %d",a1);
printf("\n");
printf("the number of notes of type b1 = %d",b1);
printf("\n");
printf("the number of notes of type c1 = %d",c1);
getch();

}


What is the error , it compiles the prog successfully but after that shows error
 
Technology news on Phys.org
scanf("%d",&p);
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Back
Top