Thursday, June 3, 2021

STOCK MARKET|C PROGRAMMING|R2C TEHNOLOGIES

 


SIMPLE STOCK MARKET CHECKING PROGRAM

In this tutorial we are going to see how to do a simple stock checking program. Let us see how the program works….

*    We are using stdio.h to get the standard input and output of the program. I declare stock=150 as a constant here and as a variable we are using sales, today, shampoo and soap.

 

*    In the print statement we are using enter no of shampoos as a string and using scanf we are giving input for the shampoos. As same as shampoos we are doing same things for soap.

 

*    Next at sales we are declaring that sales= shampoo + soap and we are declaring  toady=stock-sales and in the next print statement we are giving the string enter the sales we are giving  %d to declare the  integer and the integer value will be taken from the sales.

 

*    At last the amount will be subtracted with stock to get the output. We are using return 0 to declare the program is end.

Try it out for yourself to learn more!!!

 

Program:

#include <stdio.h>

int main()

{

    int stock=150;

    int sales,today,shampoo,soap;

     printf("enter the no of shampoos: ");

    scanf("%d",&shampoo);

    printf("enter the no of soaps: ");

    scanf("%d",&soap);

  

     sales=shampoo+soap;

      today=stock-sales;

    printf("enter the sales :%d\n",sales);

    printf("available stock is :%d\n",today);

return 0; 

}

OUTPUT:

Enter the no of shampoo: 5

Enter the no of soap: 5

Enter the sales: 10

Available stock is: 140

 


USD TO INR C++ PROGRAMMING

  NALLAMUTHU GOUNDER MAHALINGAM COLLEGE                                                 POLLACHI-642001                                     ...