# I'm a beginner and I need help

This is a discussion on I'm a beginner and I need help within the C Programming forums, part of the General Programming Boards category; I started 'c' programming about 2 weeks ago, and our instructer is going way too fast. I've been given so ...

1. ## I'm a beginner and I need help

I started 'c' programming about 2 weeks ago, and our instructer is going way too fast.
I've been given so many asingments, but i got stuck on this one.
I have to write a program, without using loop.
the program has to take a fractional number and round it to two decimal places. ex. 32.4851, to 32.49.
I know this looks pathetic to all of you, but I'm a begginer, and would really appretiate your help. thank you.

2. You can specify the number of decimal places when you output the number
Code:
```#include <stdio.h>

int main()
{
double num;

num = 32.4851;

printf("%.2lf", num); /* .2 specify's 2 decimals */

return 0;
}```

3. I think your instructor wants you to round the numbers using the truncation property of integer division. A possible solution may be to multiply the number by 100 or so, to get rid of the decimal, then change or cast the number to an integer, add 5 or so to make up for what you are going to truncate, and then divide the number by 100 or so. You'll have to play with the numbers in order to get it to work. Look up rounding in your textbook.