Write a program that declares an initializes two variables a & b with the values your choice, use pointer to those variables
and perform, addition, subtraction and multiplication: Print the results.
#include <stdio.h>
int main()
{
//declaration of two variables and pointers to those
variables
int firstnum, secondnum, *p, *q;
int sum, sub, mul;
printf("Enter the value of first number:\n");
scanf("%d", &firstnum);
printf("Enter the value of second number:\n");
scanf("%d", &secondnum);
p = &firstnum;
q = &secondnum;
//perform Addition, Subtraction and Multiplication
sum = *p + *q;
sub = *p - *q;
mul = *p * *q;
//print the results
printf("Addition: Addition of entered numbers = %d\n",sum);
printf("Subtraction: Subtraction of entered numbers =
%d\n",sub);
printf("Multiplication: Multiplication of entered numbers =
%d\n",mul);
return 0;
}
Output:-
Write a program that declares an initializes two variables a & b with the values your...
Homework Part 1 Write a C program that declares and initializes a double, an int, and a char. You can initialize the variables to any legal value of your choosing. Next, declare and initialize a pointer variable to each of the variables Using printf), output the following: The address of each of the first three variables. Use the "Ox%x" format specifier to print the addresses in hexadecimal notation The value of each variable. They should equal the value you gave...
Write an applet program that would enter two variables in a text field and perform the following operations when calculate button is pressed. Design a friendly interface. Have buttons for all operations including exit. Addition Subtraction Multiplication Division
Write a program that: program starts; declares and initializes to 10 an integer variable i; uses a do loop; print on new line “loop pass # “ and i; if i = 4 break default decrement i by 1 by stating i once; test condition i > 0; just before ending print on new line “Program finished!” then terminate program.
Question 16 (4 points) Write a complete C program that declares four variables of type integer (i.e integer variables) and four variables of type pointer to integer (i.e. integer pointers). Assign the addresses into the pointers. Using the indirection operator with a pointer, assign the values 1, 2, 3, and 4 into the four integers. (Use the indirection operator with the pointers to write the integer values.) Your program should write the addresses and values of all eight variables to...
Write a JAVA program that declares and initializes an array with the following numbers: 10, 89, 50, 24, 60, 1, 15. Then ask the user for a number and check if the array contains that number. If it does, return a message to the user (print to screen) that says
Write a C program that initializes an integer array, and two scalar values a and b. Your program should multiply each elements of the array with a and add b to the product to form a new array output. Display the output array.
Write a java program that declares 10 element array (of type integers), creates and initializes the array, and perform the sum of elements of the array using for loop. public class SumArray { public static void main (String[], args) { } // end of main } // end of SumArray class
Write a complete program that: 1) declares two local integers x and y 2) defines a global structure containing two pointers (xptr,yptr) and an integer (z) 3) Declares a variable (mst) by the type of previous structure 4) requests the values of x and y from the user using only one scanf statement 5) sets the first pointer in the struct to point to x 6) sets the second pointer in the struct to point to y 7) uses the...
Write a C program as follows: Single source code file Requests the user to input two integer numbers Requests the user to make a choice between 0 (add), 1 (subtract), or 2 (multiply) Declares three separate functions Uses a pointer to these three functions to perform the requested action Outputs the result to the screen Submit your program source code file to this assignment. Sample Output Enter first integer number: 15 Enter second integer number: 10 Enter Choice: 0 for...
RAPTOR PROGRAMMING Write a program which will receive two integer values as input. Then prompt the user to choose one of the following operations and produce an output with the selected operation. 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Modulo Division Example output with response: Please enter an input: 2 Please enter another input: 3 Please choose from the follow: 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Modulo Division Output: 2 % 3 is 2.