Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>// standard library input out put
- double purchases( float Tabs[]){return
- printf("When prompted, enter an ID# and price for one purhase:\n ");
- }
- double bills(float Tabs,double price){
- return printf("Mothly snack bar bill for ID# %.0f: %lg \n",Tabs, price);
- }
- int main(void) {
- double price;
- double ID;
- int counter=0;
- float Tabs[7]={0,1,2,3,4,5,6};
- purchases(Tabs);
- for(;;){
- scanf("%lg",&ID);
- if(ID>=0&&ID<=6){
- scanf("%lg",&price );
- counter++;
- if(price<0.0){printf("Data set is ignored; The price must be > 0.0\n");counter-=1;break;}
- }
- else{break;}}//the else statement will
- printf("%i purchases were entered\n",counter);
- for(int i=0;i<=6;i++){
- bills(Tabs[i],price);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment