answersLogoWhite

0


Best Answer

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
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

#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();

}

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

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

This answer is:
User Avatar

User Avatar

Anonymous

Lvl 1
4y ago

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

This answer is:
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
Related questions

How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


Write a c program to accept a numbers and generate square root cube and exponential values?

write a c program to accept a number and generate a square root cube and exponential values


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


How do you write the pseudo codes that will accept 7 numbers and display their sum?

Start accept 7 number calculate sum print sum stop


Write a program in COBOL to find the largest of N number?

identification division. program-id. greatest. environment division. data division. working-storage section. 77 a pic 999. 77 b pic 999. 77 c pic 999. procedure division. greatest. display "ENTER THE THREE NUMBERS:". accept a. accept b. accept c. if a &gt; b and a &gt; c display a "is greatest" else if b &gt; c display b "is greatest" else display c "is greatest". display " thank you". stop run.


How do you write a Qbasic program to display these Numbers-0112358132134?

you do this 10 print "0112358132134" use the whole of the thing


How can you write a c program to display numbers in ascending order in array?

I know how to do this and you need to know how to do this. Why don't you do your best at writing this program and if it does not work then ask for help. You will not learn anything if I give you the answer.


Write a program that will accept two numbers and find their sum anddifferences. If the sum is more than the difference, display the sum otherwisedisplay the difference. Pascal programming?

program SumAndDifference; var num1, num2, sum, difference: integer; begin write('Enter first number: '); read(num1); write('Enter second number: '); read(num2); sum := num1 + num2; difference := num1 - num2; if sum &gt; difference then written('The sum is greater: ', sum) else written('The difference is greater: ', difference); end. This program will prompt the user to enter two numbers, calculate their sum and difference, and then compare the two values. If the sum is greater than the difference, it will display the sum; otherwise, it will display the difference.


Write a program to accept 2 numbers and tell whether the product of the two number is equal to or greater than 1000?

C programm


How can I write a program to display prime numbers from 1 to 100?

Write a function that implements an algorithm that checks to see if a particular integer is prime (returning a boolean). Write a program that uses that function on each number from 1 to 100, and if true, displays that number.


Write a program to display the name of days when a user enters a number?

write a program to display your name age class schoolname e-mail 2hobby based on choice


Write a program to display your name on computer screen?

Faisal