D
D.j.
#include <stdio.h>
#include <stdlib.h>
#include <time.h> /* contains prototype for function time */
/* function main beins program execution */
void menu(void);
void add(void);
int main()
{
char choice;
srand( time( NULL ) ); /* randomize number generator using current time */
menu();
while ( choice != 'X' )
{printf( "Your Choice " );
scanf( "%c", &choice );
switch (choice)
{
case 'A':
add();
break;
}
}
return 0;
}
void menu(void)
{
printf( "Addition===========>A\n" );
printf( "Subtractin=========>S\n" );
printf( "Multiplication=======>M\n" );
printf( "Division===========>D\n" );
printf( "Remainder=========>R\n" );
printf( "Exit==============>X\n" );
return;
}
void add(void)
{
int num1;
int num2;
int answer;
int ranswer;
int counter = 1;
num1 = 1 + ( rand() % 999);
num2 = 1 + ( rand() % 999);
answer = num1 + num2;
ranswer = num1 + num2;
printf( "%d + %d ", num1,num2 );
scanf( "%d%d", num1,num2 );
while ( answer != ranswer )
{
printf( "Incorrect, try again." );
printf( "%d + %d == ", num1,num2 );
scanf( "%d", &answer );
if ( counter ==3 )
printf( "%d + %d = %d" );
}
return;
}
#include <stdlib.h>
#include <time.h> /* contains prototype for function time */
/* function main beins program execution */
void menu(void);
void add(void);
int main()
{
char choice;
srand( time( NULL ) ); /* randomize number generator using current time */
menu();
while ( choice != 'X' )
{printf( "Your Choice " );
scanf( "%c", &choice );
switch (choice)
{
case 'A':
add();
break;
}
}
return 0;
}
void menu(void)
{
printf( "Addition===========>A\n" );
printf( "Subtractin=========>S\n" );
printf( "Multiplication=======>M\n" );
printf( "Division===========>D\n" );
printf( "Remainder=========>R\n" );
printf( "Exit==============>X\n" );
return;
}
void add(void)
{
int num1;
int num2;
int answer;
int ranswer;
int counter = 1;
num1 = 1 + ( rand() % 999);
num2 = 1 + ( rand() % 999);
answer = num1 + num2;
ranswer = num1 + num2;
printf( "%d + %d ", num1,num2 );
scanf( "%d%d", num1,num2 );
while ( answer != ranswer )
{
printf( "Incorrect, try again." );
printf( "%d + %d == ", num1,num2 );
scanf( "%d", &answer );
if ( counter ==3 )
printf( "%d + %d = %d" );
}
return;
}