# TOPIC

#### William B asked 1 year ago

``````#include <stdio.h>

int main() {

int v,n;
scanf("%d%d",&v,&n);
int t,i;
t = v*n;
int percent = 10;
for(i=0;i<8;i++){
printf("%d ",((percent*t)/100)+1);
percent += 10;
}
printf("%d\n",((90*t)/100)+1);
return 0;
}``````

Remember not post solutions. Your post may be reviewed by our moderators.

• #### andre_br12 replied 1 year ago

Utilizando a biblioteca math.h é possível utilizar a função ceil() que arredonda para cima. Por ex. ceil(1.1)= 2 ou ceil(3.6)=4

• #### feodorv replied 1 year ago

Oh. I mean

``````if( (percent*t) % 100 == 0 )
printf( "%d ",  (percent*t) / 100);
else
printf( "%d ",  (percent*t) / 100 + 1);``````

t is still int type, and you should be prepared to PE (Presentation Error).

• #### William B replied 1 year ago

``````#include <stdio.h>

int main()
{
int v;
long long int n;
scanf("%d%lld",&v,&n);
int t,i;
t = v*n;
int percent = 10;

for(i=0;i<9;i++){
printf("%d ", (percent*t)/100);
percent += 10;
}
printf("\n");

return 0;
}``````

but this form, the values not match! :(

input: 3 17

10%

51 * 10 / 100 = 5.1 not 6

• #### feodorv replied 1 year ago

v can be up to 10^4, n can be up to 10^4, so

``90*t``

can be out of integer interval. Moreover, if (percent.t) % 100 == 0 or (90.t) % 100 == 0 then no need in +1.