Exemple #1
0
int main(void)
{
  int mins = GetPositiveInt();
  // converts minutes to bottles 
  mins = (mins * 1.5 * 128) / 16;
  // prints the number of bottles
  printf("bottles: %i\n", mins);
}
Exemple #2
0
int main(void) {
    int c = GetPositiveInt();
    for(int i = 0; i < c; i++){
        for(int j=0; j < c-i-1; j++){
            printf("%s", " ");
        }
        
        for(int k=0; k < i+2; k++){
            printf("#");
        }
        printf("\n");
    }
    return 0;
}
int main() {
    Randomize();
    int numVoters;
    double percentSpread, percentError;

    cout << "Enter number of voters: ";
    numVoters = GetPositiveInt();
    cout << "Enter percentage spread between candidates: ";
    percentSpread = GetPercent();
    cout << "Enter voting error percentage: ";
    percentError = GetPercent();

    cout << endl;
    double chance = chanceOfInvalid(numVoters, percentSpread, percentError);
    cout << "Chance of an invalid election result "
	 << "after 500 trials = " << chance << endl;
    return 0;
}
Exemple #4
0
int main(void)
{
	int n = GetPositiveInt();
	printf("Thanks for the %i!\n", n);
}
Exemple #5
0
int main (void)
{
    int n = GetPositiveInt ();
    PrintInt (n);
}