logo

The order of the substitution

   

Added on  2022-09-06

11 Pages1382 Words18 Views
 | 
 | 
 | 
Running head: C PROGRAMMING
C PROGRAMMING
Enter the name of the Student:
Enter the name of the University:
Author note:
The order of   the   substitution_1

C PROGRAMMING1
1.
Run# Input (x) Input (y) Expected Output
1 10 20 30
2 0 0 0
3 124 356 480
4 -30 -90 -120
The screenshots of these above successful tests are as follows:
Figure 1: Test 1 of addition
(Source: Created by author)
Figure 2: Test 2 of addition
The order of   the   substitution_2

C PROGRAMMING2
(Source: Created by author)
Figure 3: Test 3 of addition
(Source: Created by author)
Figure 4: Test 4 of addition
(Source: Created by author)
2. The C code to calculate the product of two integers is as follows:
// C code
// This program will product two integer numbers to yield a third integer number.
// Developer: Faculty CMIS102
The order of   the   substitution_3

C PROGRAMMING3
// Date: Jan 31, XXXX
#include <stdio.h>
int main ()
{
int x, y, z; /* variable definition: */
x = 0; y = 0; /* variable initialization */
printf("Developer: Faculty CMIS102 ");
printf("Date: Jan 31, 2020");
printf("\n enter a value for x: \t"); //Prompt for user input
scanf("%d" , &x); //Get the user response
printf("\n enter a value for y: \t"); //Prompt for user input
scanf("%d", &y); //Get the user response
z = x * y; //Calculate the product
//Print out the answer
//Note: x,y,z are Declared as Integer, hence we use %d as the formatter.
//Wherever you put the formatter symbol (i.e %d) is where the variable value is substituted.
//The order of the substitution is the same as the order of the variable list at the end (a,b,c)
//Note the tab (\t) in the statement also.
printf("\n\n The product of Integers (%d) and (%d) is : \t %d \n", x, y, z);
// value of x is substituted here ^ value of y ^ value z ^ here
The order of   the   substitution_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents