The object of the project is to create an application that can calculate math tables.
The Math Table using the ‘C’ application is created to make students’ maths skills better. The application or program created from this project includes the option like to enter the user name, the option to practice table, the option to choose a table for practice, the option to check whether the answer is right or wrong and correct it, show the number of wrongs and right answer, and final option to practice again.
The project Advance Math Table is based on C and the code for the program is:
C – Code for Advance Math Table Project:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <conio.h> #define NAMELEN 11 #define MAX 10 #define MIN 1 char name[NAMELEN]; short int number,wrong; int table,answer,ch; int checktable(int table); int checktable(int table); void cap(char *ptr2name); int main(void) { printf("\t\t\t\t\tWelcome to"); printf("\t\t\t\t\tMath Table"); delay(2000); clrscr(); printf("\t\t\t\t\tSubmitted to:"); delay(2000); clrscr(); printf("\nMATH Table by DLT\n"); printf("Please enter your name (max. %d): ",NAMELEN-1); gets(name); cap(name); printf("\nDo you want to practise some tables? (Y/N) ",name); ch = toupper((int)getch()); if (ch == 'N') { printf("\nOkidoki %s, but you'll have to do extra tomorrow!\n",name); exit(EXIT_SUCCESS); } else do { wrong=0; printf("\nWhich table? "); scanf("%d",&table); checktable(table); number = MIN; // The table payment made here // Ans controller. do { printf("%d x %d = ",number,table); scanf("%d",&answer); if (answer != (number*table)) { printf("WRONG! %d x %d = %d!\n",number,table,number*table); wrong++; } // assessment. } while (number++ != (MAX)); switch(wrong) { case 0: printf("\n%s: I'm proud of you! No wrong answer found practising table of %d!",name,table); break; case 1: case 2: printf("\n%s: Good work! You gave only %d wrong answers doing table of %d.",name,wrong,table); break; case 3: case 4: printf("\n%s: Can't you do a lot better? %d wrong anwers found doing table of %d.",name,wrong,table); break; default : printf("\n%s: Practise a little more. You gave %d wrong answers doing table %d.",name,wrong,table); } printf("\nDo you want to practice again? (Y/N) "); ch = toupper((int)getch()); printf("\n"); } while (ch != 'N'); printf("\nMATH Table Copyright by BestEngineeringProjects.com.\n"); return 0; } // here it is checked whether the integer. int checktable(int table) { if ((table < 0) || (table == '\n')) { fprintf(stderr,"\nERROR: Input has to be a valid positive integer.\n"); exit(EXIT_FAILURE); } return 1; } // change the first letter of the name in uppercase void cap(char *ptr2name) { if(ptr2name[0]) *ptr2name = toupper((int)*ptr2name); } |