HELP! (w/C program)
Ok, so I have a lab that was assigned today for my C class, and it's due tomorrow. The requirements of the lab are as follows:
Write a program that uses standard functions. The program may be written entirely in main and must follow the pseudocode below. Give the output appropriate captions, and align the data.
Pseudocode:
1. Prompt the user to enter a number
2. Read number.
3. Display number.
4. Get a random number and scale to range 3...37.
5. Display random number.
6. Set product to number + random number.
7. Display product.
8. Display ceiling of product.
9. Display floor of product.
10. Display number raised to power 5.
11. Display square root of random number.
My code:
Code:
#include stdio.h
#include stdlib.h
#include time.h
#include math.h
int main (void)
{
int user_num1 = 0;
int rand_num1 = 0;
int product = 0;
printf("Enter a number: ");
scanf("%d", &user_num1);
printf("\nThe number you entered was: %d", user_num1);
srand (time (NULL));
rand_num1 = rand() % 35+3;
printf("\nA random number: %d", rand_num1);
product = user_num1 * rand_num1;
printf("\nProduct of your number x the random number: %d", product);
double ceil (product);
double floor (product);
printf("\nThe ceiling of the product is: %10.2f", ceil);
printf("\nThe floor of the product is: %10.2f", floor);
pow (user_num1, 5);
sqrt (rand_num1);
printf("\nYour number raised to the 5th power is: %10.2f", pow);
printf("\nThe square root of the random number is: %10.2f", sqrt);
return 0;
}
It's not completed, but I'm trying to debug it as I go. You can see the issue that I'm running into in the attached screenshot. Any suggestions on why it's doing this?
The compiler is Visual C++ .net student edition, if it matters.
Here's the issue (look at the last few lines of the program):