answersLogoWhite

0

Assuming you're using the C Programming language (as you did not specify any other), and that you're making some sort of arithmetic tester, a simple answer would be:

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main()

{

time_t seconds;

time(&seconds);

srand((unsigned int)seconds);

int num1 = (rand()%100);

int num2 = (rand()%100);

int sum = num1 + num2;

int ans;

printf("What is %d + %d? ", num1, num2);

scanf("%d", &ans);

if(ans == sum) printf("Correct!");

else printf("Wrong, correct answer is %d", sum);

return 0;

}

User Avatar

Wiki User

16y ago

Still curious? Ask our experts.

Chat with our AI personalities

JudyJudy
Simplicity is my specialty.
Chat with Judy
ReneRene
Change my mind. I dare you.
Chat with Rene
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
More answers

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

clrscr();

int a,b,sum;

printf("Enter first number ");

scanf("%d",&a);

printf("Enter second number ");

scanf("%d",&b);

sum=a+b;

printf("The sum is = %d ",sum);

getch();

}

User Avatar

Wiki User

14y ago
User Avatar

Write algorithm to check whether an entered number is odd/even

User Avatar

Wiki User

15y ago
User Avatar

Write a program to sum a sequence of integers between two numbers that are entered by user. The program does not include the numbers that can be divided by 10 to total sum. Note: you should use continue control statement and you can control division by 10 using mod operator like i %10

User Avatar

Anonymous

5y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to accept two numbers and display their sum?
Write your answer...
Submit
Still have questions?
magnify glass
imp