answersLogoWhite

0

#include<stdio.h> main() { int a,b,c,d; // The four integers to be asked printf("Give the first integer: "); //asks for the first integer scanf("%d",&a); // puts the user input in the address of the integer "a" printf("Give the second integer: "); //same explanations scanf("%d",&b); printf("Give the third integer: "); scanf("%d",&c); printf("Give the fourth integer: "); scanf("%d",&d); printf("1. The sum of the four integers is: %d",a+b+c+d); //prints the sum of the four integers given by the user, notice the "a+b+c+d" at the end) printf("2. The sum of the first two numbers minus the sum of the last: %d",a+b-c-d); //prints the second condition by putting the correct operations return 0; //ends the program } I never tested this program though, but i think it would work.

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Engineering

Write a program to subtract integer y from integer x?

x -=y;


Write a FORTRAN code to calculating factorials?

Here is a simple FORTRAN code to calculate the factorial of a given non-negative integer: program factorial implicit none integer :: n, result print *, &quot;Enter a non-negative integer:&quot; read *, n result = 1 if (n &lt; 0) then print *, &quot;Factorial is not defined for negative numbers.&quot; else do i = 1, n result = result * i end do print *, &quot;Factorial of&quot;, n, &quot;is&quot;, result end if end program factorial This program prompts the user for an integer, checks if it's non-negative, and then calculates the factorial using a loop.


Write a program in c that prompt user with following lines add two integers test an integer for odd or even and quit?

write a program in C that prompts the user with the following lines: a) Add two integers c) Compare two integers for the larger t) Test an integers for odd or even q) Quit


What a program of add to number in visul basic net?

In Visual Basic .NET, you can create a simple program to add two numbers by using input boxes or text fields to gather user input. For example, you would declare two variables to store the numbers, convert the input to numeric types, and then perform the addition. Finally, you can display the result using a message box or a label. Here's a basic example: Dim num1 As Integer = Convert.ToInt32(InputBox(&quot;Enter first number:&quot;)) Dim num2 As Integer = Convert.ToInt32(InputBox(&quot;Enter second number:&quot;)) Dim sum As Integer = num1 + num2 MessageBox.Show(&quot;The sum is: &quot; &amp; sum)


Write a VB script program to calculate the sum of first 20 even numbers?

dim a(20) as integer dim i as integer dim n as integer private sub command_click() for i 1 to 20 Next i a(i) = inputbox ("enter any no.""no.""0") Next i for i = 1 to 20 print a(i) n=n/i if n mod 2 = 0 then Next i end if msgbox "even numbe"&amp;even end if

Related Questions

How do you find sum of 100 numbers using fortran programme?

The following is for F95 and later (due to the use of intrinsic SUM ): My assumptions: -Your numbers are integers -Your numbers are stored in an array -The numbers you are describing are 0-100 program findSum !I assumed integer, replace this with your data type integer, dimension(100) :: numbers integer :: sumOfNumbers !We populate an array with our numbers !Replace this with your numbers do i=1,(size(numbers)+1) numbers = i end do !We find the sum of those numbers sumOfNumbers = sum(numbers) !We write out the sum to prompt write(*,*) 'Sum is: ', sumOfNumbers end program findSum


How write a java program to generate random numbers in between 0-100 and print only the odd numbers?

Use a pseudo-random number generator to produce random integers. To determine if a given integer is odd or even, use the following functions: bool is_odd (int x) { return x%2; } bool is_even (int x) { return !is_odd (x); }


Write a program to compute the sum of first ten integer numbers in PHP?

$n = 10*(1+10)/2;


What is the code of a c program that will read in a positive integer value and determine If the integer is a prime number and If the integer is a Fibonacci number?

see the program


Write a program to subtract integer y from integer x?

x -=y;


What happens when java program attempts to divide one integer by another?

In that case, unless you specifically convert ("cast") at least one of the numbers to a double or float, the result will also be an integer. Example: 1 / 3 = 0


write simple program to solve the following problems : add the following numbers = 10,222,99,999,74,532?

A+(B+C**3) (A-(+D+B/A+B)


Write a C program that prompts the user for three decimal numbers and prints them trimmed as integer values. For example, if the user informs the values 13.2, 12.5, 102.231, the program prints out 13, 12, 102?

Here's a simple C program that prompts the user for three decimal numbers, converts them to integers, and prints the trimmed integer values: c Copy code #include int main() { double num1, num2, num3; // Prompt the user for three decimal numbers printf(&quot;Enter three decimal numbers: &quot;); scanf(&quot;%lf %lf %lf&quot;, &amp;num1, &amp;num2, &amp;num3); // Convert and print the trimmed integer values int intNum1 = (int)num1; int intNum2 = (int)num2; int intNum3 = (int)num3; printf(&quot;Trimmed integer values: %d, %d, %d\n&quot;, intNum1, intNum2, intNum3); return 0; } In this program: We declare three variables num1, num2, and num3 to store the decimal numbers entered by the user. We use printf to prompt the user to enter three decimal numbers. We use scanf to read and store the user's input in the variables num1, num2, and num3. We then convert these decimal numbers to integers by casting them using (int) and store them in intNum1, intNum2, and intNum3. Finally, we use printf again to print the trimmed integer values. Compile and run the program, and it will prompt you for three decimal numbers and print their trimmed integer values as requested.


Is -5 a integer?

1 hour ago my c program said no, but now I know 5 actually is an integer!


What is the program to find sum of n natural numbers in c plus plus?

Initialise an unsigned integer to zero. As each number is input, increment the running total accordingly. When all numbers are input, display the total.


How to draw Raptor flow chart for prime number?

Raptor is a program used for script writing and can be used to make flowcharts. Creating a flow chart for determining prime numbers can be done by writing a code that outlines the rules of prime numbers such as dividing by any integer other than the number itself and 1 to get an integer with a remainder.


Write a FORTRAN code to calculating factorials?

Here is a simple FORTRAN code to calculate the factorial of a given non-negative integer: program factorial implicit none integer :: n, result print *, &quot;Enter a non-negative integer:&quot; read *, n result = 1 if (n &lt; 0) then print *, &quot;Factorial is not defined for negative numbers.&quot; else do i = 1, n result = result * i end do print *, &quot;Factorial of&quot;, n, &quot;is&quot;, result end if end program factorial This program prompts the user for an integer, checks if it's non-negative, and then calculates the factorial using a loop.