Why won't my program accept decimals?
<p>I am trying to make my program work, but in the second prompt, when I input a decimal, the program stops working. I do not understand what I am doing wrong. This is due tonight at 11:59 EST! Please help!`It works for whole numbers perfectly but not decimals!</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;math.h&gt;


//main function
int main() {

    //variables
    int people, squares, blankets, leftovers;
    float newpeople;

    //prompt user
    printf("How many people are knitting blanket squares at the beginning of the week?\n");
    scanf("%d", &amp;people);

    printf("How many new people are knitting blanket squares?\n");
    scanf("%f", &amp;newpeople);

    //function

    squares = people * pow((1 + newpeople), 7);
    blankets = squares / 60;
    leftovers = squares % blankets;

    //output
    printf("%d blanket squares will be made this week!\n", squares);
    printf("You will be able to make %d blankets and start next week with %d squares.\n", blankets, leftovers);

    return 0;
}
</code></pre>

<p>Assignment #2
Introduction to C Programming – COP 3223</p>

<p>Objectives
    To give students practice at typing in, compiling and running simple programs.
2.  To reinforce knowledge of assignment statements and arithmetic expressions</p>

<p>Introduction: Programmers for a Better Tomorrow
Programmers for a Better Tomorrow is an organization dedicated to helping charities, medical societies, and scholarship organizations manage various tasks so that they can focus on making the world a better place!  They have asked you and your classmates to help them develop some new programs to benefit their organizations.</p>

<p>Problem: Knitting for Fun and Non-Profit Part 2 (knit2.c)
One of the programs that Programmers for a Better Tomorrow supports knits hats, sweaters, and blankets for people who may not have enough to keep them warm.  These may be sent to other places in the country or overseas.</p>

<p>Each donated blanket is made from 60 knitted squares.  These blanket squares are simple and can be made in one day.  The BlanketSquares program is becoming very popular and the number of squares made every day is increasing at an exponential rate.</p>

<p>In this program, you will track the number of squares being made in one week using the exponential growth function (shown below).</p>

<p>X=a(1+b)^t</p>

<p>a represents the initial population, this is the number of people already making blanket squares on the first of the week.  b represents the growth rate, this is the number of new people knitting blanket squares each day.  t represents the time interval, which is 7 days for our program.</p>

<p>Your program should calculate X – the number of squares made this week – and print that information for the user. </p>

<p>Then, your program should calculate the number of blankets that can be made from these squares.  Print this information and the number of left over squares.  </p>

<p>Input Specification
    The number of people making squares on the first day of the week, a, where a is a positive integer
    The number of new people making squares each day, b, where b is a positive number value.  (This value may be a decimal.  If there are three new people every two days, this can be represented by 1.5 people per day)</p>

<p>Output Specification
Output the result using the format below:</p>

<p>X blanket squares will be made this week!<br>
You will be able to make Y blankets and start next week with Z squares.</p>

<p>Output Sample
Below are some sample outputs of running the program. Note that these samples are NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above. </p>

<p>In the sample run below, for clarity and ease of reading, the user input is given in italics while the program output is in bold. (Note: When you actually run your program no bold or italics should appear at all. These are simply used in this description for clarity’s sake.)</p>

<p>Sample Run #1
How many people are knitting blanket squares at the beginning of the week?
 1
How many new people are knitting blanket squares each day?
.5</p>

<p>17 blanket squares will be made this week!
You will be able to make 0 blankets and start next week with 17 squares.</p>

<p>Sample Run #2
How many people are knitting blanket squares at the beginning of the week?
3
How many new people are knitting blanket squares each day?
2</p>

<p>6561 blanket squares will be made this week!
You will be able to make 109 blankets and start next week with 21 squares.</p>

<p>Deliverables
One source files – knit2.c – is to be submitted over WebCourses.</p>

<p>Restrictions
Although you may use other compilers, your program must compile and run using Code::Blocks. Your program should include a header comment with the following information: your name, course number, section number, assignment title, and date. Also, make sure you include comments throughout your code describing the major steps in solving the problem.</p>

<p>Grading Details
Your programs will be graded upon the following criteria:</p>

<p>1) Your correctness</p>

<p>2) Your programming style and use of white space. Even if you have a plan and your program works perfectly, if your programming style is poor or your use of white space is poor, you could get 10% or 15% deducted from your grade.</p>

<p>3) Compatibility – You must submit C source files that can be compiled and executed in a standard C Development Environment.  If your program does not compile, you will get a sizable deduction from your grade.</p>