Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main(){
- srand(time(0));
- int a, age, age1 , mark ,b ,bin;
- char first[10], first1[10], last[10], last1[10], web[30], disk[30];
- float answer;
- int operator = rand()%-50-1;
- char ops[5] = {'+', '-', '*', '/'};
- int worked = 1;
- printf("Welcome to our program");
- printf("\n1- High school \n2- University UG \n3- Master or higher");
- printf("\nChoose one of the following : ");
- scanf("%d", &a);
- switch(a){
- case 1:
- printf("You Have to Pass the exam before enter our program");
- break;
- case 2:
- printf("You're Elegible to join our program now !");
- break;
- case 3:
- printf("You're not allowed to join our program , Sorry");
- break;
- default :
- printf("Error ! , Please choose a number from 1 - 3 , Thanks!");
- break;
- }
- if (a == 1)
- {
- printf("\nPlease Register for the exam :");
- printf("\nWhat is Your First Name : ");
- scanf("%s", &first1);
- printf("\nWhat is Your Last Name : ");
- scanf("%s", &last1);
- printf("\nWelcome %s %s", first1 , last1);
- printf("\nWhat is your age : ");
- scanf("%d", &age1);
- printf("\n1- Math \n2- Computer");
- printf("\nPlease choose one question from these : ");
- scanf("%d", &b);
- switch(b){
- case 1:
- printf("\nWelcome! Solve this Equation:\n\n");
- printf("%d%c%d=?\n\n", rand()%-50-1, ops[rand()%4], rand()%-50-1);
- scanf("%d\n", &answer);
- switch (ops[4]) {
- case'ops[5]':
- answer = operator, ops[rand()%4], operator;
- break;
- default:
- printf("I'm sorry, that is not correct. keep trying.\n");
- worked = 0;
- }
- if (worked ==1) {
- printf("Congratulations! You have answered the problem correctly!%d\n", answer);
- }
- break;
- case 2:
- printf("\nThe concentric circles on the floppy disk are further divided into : ");
- scanf("%s", &disk);
- printf("\nGive an example of a binary number : ");
- scanf("%s", &bin);
- printf("\nA Web site's main page is called : ");
- scanf("%s", &web);
- break;
- default :
- printf("Error ! , Please choose a number from 1 - 2 , Thanks!");
- break;
- }
- printf("Thanks We will Contact with you soon !\n");
- }
- else if (a == 2)
- {
- printf("\nPlease register : ");
- printf("\nWhat is Your First Name : ");
- scanf("%s", &first);
- printf("\nWhat is Your Last Name : ");
- scanf("%s", &last);
- printf("\nWhat is your age : ");
- scanf("%d", &age);
- printf("\nWhat is your Marks : ");
- scanf("%d", &mark);
- printf("\nYou have been Registered Successfully ");
- printf("\nWelcome %s %s", first, last);
- printf("\nWe will Contact you soon .\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement