Skip to content

Instantly share code, notes, and snippets.

@NickCarneiro
Created January 19, 2012 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickCarneiro/1638645 to your computer and use it in GitHub Desktop.
Save NickCarneiro/1638645 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(){
/*Declare Variables*/
float yrly_income, mthly_exp, savings, percent_savings, vacation, tracker;
FILE *vacationptr;
/*Create and verify output file*/
vacationptr= fopen ("c07result.txt", "w");
if (vacationptr==NULL)
{
printf("The file 'c07result.txt' did not open\n.");
}
/* Request and retrieve the user intiial yearly income*/
printf("Please input yearly income.\n");
scanf("%f", &yrly_income);
while(yrly_income>0){
/*request and retrieve monthly expenses and % to save*/
printf("Please input your monthly expenses and percentage savings desired separated by a space.\n");
scanf("%f,%f",&mthly_exp,&percent_savings);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment