Write a program that gives simple math quizzes The program s

Write a program that gives simple math quizzes. The program should display two random numbers that between 1 and 10 that are to be added such as 10+2=. The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed. The program should use 4 separate functions for displaying the problem, getting the user answer, calculating the correct answer and displaying the result. The program should have a main function from which these functions are called.

Solution

In this problem u don\'t mention about programing lanuage (C/C++/JAVA/Python/C#) , so i write the code in C language

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include <time.h>
void problem()
{
   // please change the message according to your situation 15
   printf(\"This Is The quize time student Please Enter the number between[1-20]\");
   printf(\"if your number is match with system generated number you will win\");
   printf(\"So let\'s Start\");
   printf(\"\ \");
   printf(\"*****************************************************************\");
   printf(\"\ \");
   printf(\"\ \");
   printf(\"\ \");
   printf(\"\ \");
}
int User_Enter_Number()
{
   int n;
   printf(\"Enter Number between[0-10] For quize\"); // it\'s your choice keep this line or not
   scanf(\"%d\",&n);
   return n;
}
int compair(int c,int u)
{
   if(c==u)
   {
       return 1;
   }
      
   else
   {
       return 0;
   }
      
}
void result(int t)
{
if(t==1)
{
   printf(\"\ Congratulation you win!!\ \");
}
else
{
    printf(\"\ OOP\'s try Again!!!!! \ \");
}
}
int main()
{
   int t;
   int a,b,c,u;
   time_t t1;
   problem();
   // below code generate two random number between [0-10]
   srand((unsigned) time(&t1));
   a= rand()%10+1;
   b=rand()%10+1;
   clrscr();
//printf(\"%d %d\",a,b);
// if you want to see the generated number please uncomemt the above line
   c=a+b;
   u= User_Enter_Number();
t= compair(c,u);
result(t);
   getch();
   return 0;
}

Write a program that gives simple math quizzes. The program should display two random numbers that between 1 and 10 that are to be added such as 10+2=. The prog
Write a program that gives simple math quizzes. The program should display two random numbers that between 1 and 10 that are to be added such as 10+2=. The prog

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site