Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char name[22];
- char date[14];
- char ch=0;
- int ns=0;
- int r=0;
- float bp=0,cp=0,yf=0,total=0,total2=0;
- //task1
- memset(name, 0, 22);
- memset(date, 0, 14);
- //initialize variables
- bp=0;
- cp=0;
- yf=0;
- total=0;
- ns=0;
- printf("----------------------------\n");
- printf("enter date of purchase for aviator: ");
- r=read(0, &date, 13);
- name[r-1]=0;
- date[r-1]=0;
- printf("enter number of shares purchased: ");
- scanf("%d", &ns);
- printf("enter the buying price per share:");
- scanf("%f", &bp);
- printf("enter the current price per share:");
- scanf("%f",&cp);
- printf("enter the yearly fees of %s:", name);
- scanf("%f",&yf);
- printf("----------------------------\n");
- printf("Stock name: %s\n", name);
- printf("Purchase date: %s\n", date);
- printf("Buying price per share of %s $%0.2f\n", name, bp);
- printf("Current price per share of %s $%0.2f\n", name, cp);
- printf("Yearly fees of %s $%0.2f\n", name, yf);
- printf("Initial Cost: $%0.2f\n", ns*bp);
- printf("Current Cost: $%0.2f\n", ns*cp);
- printf("Profit: $%0.2f\n", ns*cp-ns*bp-yf);
- total2+=(ns*cp-ns*bp-yf);
- //task1
- memset(name, 0, 22);
- memset(date, 0, 14);
- //initialize variables
- bp=0;
- cp=0;
- yf=0;
- total=0;
- ns=0;
- printf("----------------------------\n");
- printf("enter date of purchase for bonzo: ");
- r=read(0, &date, 13);
- name[r-1]=0;
- date[r-1]=0;
- printf("enter number of shares purchased: ");
- scanf("%d", &ns);
- printf("enter the buying price per share:");
- scanf("%f", &bp);
- printf("enter the current price per share:");
- scanf("%f",&cp);
- printf("enter the yearly fees of %s:", name);
- scanf("%f",&yf);
- printf("----------------------------\n");
- printf("Stock name: %s\n", name);
- printf("Purchase date: %s\n", date);
- printf("Buying price per share of %s $%0.2f\n", name, bp);
- printf("Current price per share of %s $%0.2f\n", name, cp);
- printf("Yearly fees of %s $%0.2f\n", name, yf);
- printf("Initial Cost: $%0.2f\n", ns*bp);
- printf("Current Cost: $%0.2f\n", ns*cp);
- printf("Profit: $%0.2f\n", ns*cp-ns*bp-yf);
- total2+=(ns*cp-ns*bp-yf);
- //task1
- memset(name, 0, 22);
- memset(date, 0, 14);
- //initialize variables
- bp=0;
- cp=0;
- yf=0;
- total=0;
- ns=0;
- printf("----------------------------\n");
- printf("enter date of purchase for cheery: ");
- r=read(0, &date, 13);
- name[r-1]=0;
- date[r-1]=0;
- printf("enter number of shares purchased: ");
- scanf("%d", &ns);
- printf("enter the buying price per share:");
- scanf("%f", &bp);
- printf("enter the current price per share:");
- scanf("%f",&cp);
- printf("enter the yearly fees of %s:", name);
- scanf("%f",&yf);
- printf("----------------------------\n");
- printf("Stock name: %s\n", name);
- printf("Purchase date: %s\n", date);
- printf("Buying price per share of %s $%0.2f\n", name, bp);
- printf("Current price per share of %s $%0.2f\n", name, cp);
- printf("Yearly fees of %s $%0.2f\n", name, yf);
- printf("Initial Cost: $%0.2f\n", ns*bp);
- printf("Current Cost: $%0.2f\n", ns*cp);
- printf("Profit: $%0.2f\n", ns*cp-ns*bp-yf);
- total2+=(ns*cp-ns*bp-yf);
- //task1
- memset(name, 0, 22);
- memset(date, 0, 14);
- //initialize variables
- bp=0;
- cp=0;
- yf=0;
- total=0;
- ns=0;
- printf("----------------------------\n");
- printf("enter date of purchase for downer: ");
- r=read(0, &date, 13);
- name[r-1]=0;
- date[r-1]=0;
- printf("enter number of shares purchased: ");
- scanf("%d", &ns);
- printf("enter the buying price per share:");
- scanf("%f", &bp);
- printf("enter the current price per share:");
- scanf("%f",&cp);
- printf("enter the yearly fees of %s:", name);
- scanf("%f",&yf);
- printf("----------------------------\n");
- printf("Stock name: %s\n", name);
- printf("Purchase date: %s\n", date);
- printf("Buying price per share of %s $%0.2f\n", name, bp);
- printf("Current price per share of %s $%0.2f\n", name, cp);
- printf("Yearly fees of %s $%0.2f\n", name, yf);
- printf("Initial Cost: $%0.2f\n", ns*bp);
- printf("Current Cost: $%0.2f\n", ns*cp);
- printf("Profit: $%0.2f\n", ns*cp-ns*bp-yf);
- total2+=(ns*cp-ns*bp-yf);
- //task1
- memset(name, 0, 22);
- memset(date, 0, 14);
- //initialize variables
- bp=0;
- cp=0;
- yf=0;
- total=0;
- ns=0;
- printf("----------------------------\n");
- printf("enter date of purchase for even: ");
- r=read(0, &date, 13);
- name[r-1]=0;
- date[r-1]=0;
- printf("enter number of shares purchased: ");
- scanf("%d", &ns);
- printf("enter the buying price per share:");
- scanf("%f", &bp);
- printf("enter the current price per share:");
- scanf("%f",&cp);
- printf("enter the yearly fees of %s:", name);
- scanf("%f",&yf);
- printf("----------------------------\n");
- printf("Stock name: %s\n", name);
- printf("Purchase date: %s\n", date);
- printf("Buying price per share of %s $%0.2f\n", name, bp);
- printf("Current price per share of %s $%0.2f\n", name, cp);
- printf("Yearly fees of %s $%0.2f\n", name, yf);
- printf("Initial Cost: $%0.2f\n", ns*bp);
- printf("Current Cost: $%0.2f\n", ns*cp);
- printf("Profit: $%0.2f\n", ns*cp-ns*bp-yf);
- total2+=(ns*cp-ns*bp-yf);
- //task2
- printf("----------------------------\n");
- printf("Total profit is: $ %0.2f\n", total2);
- return 0;
- }
Add Comment
Please, Sign In to add comment