Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by Ops ( 5 years ago )
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
double n;
int x,y, suma, wyn_max;
double wyn[11] = {0};
double skal[11] = {0};
void pustka () {
printf(" ");
}
void gwiazdka () {
printf ("*");
}
int max (int a[]) {
for (int i=2; i<=12; i++){
if (a[i+1]>a[i]){
return a[i+1];
}
else {
return a[i];
}
}
}
int main()
{
scanf("%lf", &n);
for (int i=1; i<=n; i++) {
srand((unsigned) time(NULL));
x=(rand()%6);
y=(rand()%6);
suma = x + y;
wyn[suma-2]++;
}
wyn_max = max(wyn);
for (int i=0; i<=10; i++) {
skal[i] = wyn[i]/wyn_max;
}
for (int k=20; k>=1; k--) {
for (int suma=0; suma<=10; suma++){
if(skal[suma]>=k){
gwiazdka;
}
else {
pustka();
}
}
pustka();
printf("\n");
}
return 0;
}
Revise this Paste