// This C program divisors.c is to determine divisors of your birth year // Author ... (type here your name) // Date ... (type here the current date) // For ... (institution, course, purpose) //--------------------------------------------------------------------------- #include //Handles the keyboard input and screen output #include //Handles DOS system commands ("cls", "pause") void main() { //This part declares variables used by the program char your_name[12]; //String declaration to store your name int your_birth_year; //Stores your year of birth int i, remainder; //Loop counter, remainder of integer division int not_divisible = 1; //Replaces Boolean variable //This part inputs your details and confirms input values printf("This program is to send you a personalised hello message!"); printf("\nPlease enter your name (e.g. Jan) "); //prompts for your name scanf("%s", your_name); // Inputs your name printf("\nPlease enter year of your birth (e.g. 2002) "); //prompts year scanf("%d", &your_birth_year); // Inputs your year of birth printf("Hello %s", your_name); // Displays the Hello your-name printf("\nYour birth year is: %d", your_birth_year);// Displays your name //This part determines what your year is divisible by for (i = 2; i < 10; i++) { remainder = your_birth_year%i; if (remainder == 0) { not_divisible = 0; printf ("\nDivisible by: %d", i); } } if (not_divisible == 1) printf("\nYour year probably is a prime number!"); printf ("\n"); // Changes the line system("pause"); // DOS "Pause" command (for user to look at results) }