+ 2
[SOLVED] I need help with Halloween Candy. I cannot open from trial 2.
9 Respuestas
+ 4
You didn't use ceil() function properly.
You need to use 200.0 instead of 200 to avoid losing decimals.
#include <stdio.h>
#include<math.h>
int main() {
int houses;
int num;
scanf("%d", &houses);
num = ceil(200.0/houses );
//ceil(num);
printf ("%d",num);
return 0;
}
+ 2
you have not met the condition for rounding to an integer. your program passes the second test, where the value is an integer. and does not pass the first test, where the value is fractional and the test expects a value of 67, your program outputs an integer value of 66. apply the rounding up function to an integer.
Read this in task:
"Output Format
A percentage value rounded up to the nearest whole number."
+ 2
Thanks you very much😄😄😄💐💐
+ 2
Thank you sir💐💐💐💐
U solved my doubt.
Thank you very much💞
+ 1
Hi! what language do you decide in? could you provide us with your code?
+ 1
I am writing in c
My code is :
#include<stdio.h>
int main()
{
int houses, percentage;
Scanf(%d,&houses);
percentage=200/houses;
Printf ("%d", percentage);
return 0;
}
+ 1
always read the condition of the task carefully. otherwise, you can miss something important
+ 1
Sir i am stuck again.
Is rounding up function in c is ceil.
I am using it using math.h header.
But result still remains same
+ 1
This is my new code:
#include <stdio.h>
#include<math.h>
int main() {
int houses;
int num;
scanf("%d", &houses);
num = 200/houses ;
ceil(num);
printf ("%d",num);
return 0;
}