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

  • Thread starter Thread starter mkbh_10
  • Start date Start date
Click For 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);
 
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
14
Views
3K
Replies
7
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
47
Views
5K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K