Skip to main content

John made a huge profit out of his grocery shop. But, his profit got reduced due to his wrong calculation in providing the balance amount to his customers.

 John made a huge profit out of his grocery shop. But, his profit got reduced due to his wrong calculation in providing the balance amount to his customers.

Once he started to realize his mistakes, he is trying to make out this work with his robot. So that his profit is safe.

He finds you to provide a programming solution to his problem. Get purchase value and cash given by the customer and calculate the balance amount.

Input format

Two positive integers,

First one is the purchase value and other one is the Cash given by the customer in each line

Output format

Numerical value which is the balance amount to be given back to the Customer


Note: Printing unwanted or ill-formatted data to output will cause the test cases to fail

Sample testcases
Input 1
28
100
OUTPUT
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int purchase=0;
    int cash=0;
    scanf("%d",&purchase);
    scanf("%d",&cash);
    printf("%d",cash-purchase);
    return 0;
}

Comments

Popular posts from this blog

Raju is a Civil Engineer. He is writing software to automate his work. As a part of his requirement, he wants to calculate the circle diameter, circumference, and area. Help Raju to complete his task. Get radius as input.

OUTPUT

Implement structures to read, write and compute average- marks and the students scoring above and below the average marks for a class of N students Program and Algorithm Computer Science Engineering VTU

Structures abov below avg #include<stdio.h> struct student { char name [100]; char usn [20]; float marks; }; void main() { int i,j,k,m,n,aboveavg[100],belowavg[100]; float total=0.0,avg=0.0; struct student s[100]; printf("enter number of students\n"); scanf("%d",&n); for(i=0;i<n;i++) { printf("enter the details of students%d\n",i+1); printf("enter name\n"); scanf("%s",s[i].name); printf("enter usn\n"); scanf("%s",s[i].usn); printf("enter marks\n"); scanf("%f",&s[i].marks); total+=s[i].marks; } printf("enter the details of students\n"); printf("name\t\t usn\t\t marks\n"); for(i=0;i<n;i++) printf("%s\t\t %s\t\t %f\n",s[i].name,s[i].usn,s[i].marks); avg=total/n; printf("avg=%f\n",avg); j=0; k=0; for(i=0;i<n;i++) { if(s[i].marks>avg) abov...