Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i just need someone to add more informal comments to this program code is below:

ID: 3754224 • Letter: I

Question

i just need someone to add more informal comments to this program code is below: #include<stdio.h> //for printf and scanf #include<stdlib.h> //for abs
void Greeting() { printf("Welcome to Absolute and Quotient evaluator "); } int GetInt() { int n; scanf("%d",&n); return n; } double GetDouble() { double n; scanf("%lf",&n); return n; } int FindAbsoluteValue(int arg1, int arg2) { return abs(arg1-arg2); } double FindQuo(double arg1, double arg2) { if(arg2==0) return 0.0; else return arg1/arg2; } void main() { Greeting(); //calls Greeting function printf("Enter first and second integer: "); //prompts for first and second integers int a = GetInt(); //calls GetInt function to read integers int b = GetInt(); printf("Absolute of %d-%d is %d",a,b,FindAbsoluteValue(a,b)); printf(" Enter third and fourth integer: "); int c = GetInt(); int d = GetInt(); printf("Absolute of %d-%d is %d",c,d,FindAbsoluteValue(c,d)); printf(" Enter first and second double values: "); double p = GetDouble(); //calls GetDouble function to read double values double q = GetDouble(); printf("Quotient of %lf/%lf is %lf",p,q,FindQuo(p,q)); printf(" Enter third and fourth double values: "); double r = GetDouble(); double s = GetDouble(); printf("Quotient of %lf/%lf is %lf",r,s,FindQuo(r,s)); } i just need someone to add more informal comments to this program code is below: #include<stdio.h> //for printf and scanf #include<stdlib.h> //for abs
void Greeting() { printf("Welcome to Absolute and Quotient evaluator "); } int GetInt() { int n; scanf("%d",&n); return n; } double GetDouble() { double n; scanf("%lf",&n); return n; } int FindAbsoluteValue(int arg1, int arg2) { return abs(arg1-arg2); } double FindQuo(double arg1, double arg2) { if(arg2==0) return 0.0; else return arg1/arg2; } void main() { Greeting(); //calls Greeting function printf("Enter first and second integer: "); //prompts for first and second integers int a = GetInt(); //calls GetInt function to read integers int b = GetInt(); printf("Absolute of %d-%d is %d",a,b,FindAbsoluteValue(a,b)); printf(" Enter third and fourth integer: "); int c = GetInt(); int d = GetInt(); printf("Absolute of %d-%d is %d",c,d,FindAbsoluteValue(c,d)); printf(" Enter first and second double values: "); double p = GetDouble(); //calls GetDouble function to read double values double q = GetDouble(); printf("Quotient of %lf/%lf is %lf",p,q,FindQuo(p,q)); printf(" Enter third and fourth double values: "); double r = GetDouble(); double s = GetDouble(); printf("Quotient of %lf/%lf is %lf",r,s,FindQuo(r,s)); } #include<stdio.h> //for printf and scanf #include<stdlib.h> //for abs
void Greeting() { printf("Welcome to Absolute and Quotient evaluator "); } int GetInt() { int n; scanf("%d",&n); return n; } double GetDouble() { double n; scanf("%lf",&n); return n; } int FindAbsoluteValue(int arg1, int arg2) { return abs(arg1-arg2); } double FindQuo(double arg1, double arg2) { if(arg2==0) return 0.0; else return arg1/arg2; } void main() { Greeting(); //calls Greeting function printf("Enter first and second integer: "); //prompts for first and second integers int a = GetInt(); //calls GetInt function to read integers int b = GetInt(); printf("Absolute of %d-%d is %d",a,b,FindAbsoluteValue(a,b)); printf(" Enter third and fourth integer: "); int c = GetInt(); int d = GetInt(); printf("Absolute of %d-%d is %d",c,d,FindAbsoluteValue(c,d)); printf(" Enter first and second double values: "); double p = GetDouble(); //calls GetDouble function to read double values double q = GetDouble(); printf("Quotient of %lf/%lf is %lf",p,q,FindQuo(p,q)); printf(" Enter third and fourth double values: "); double r = GetDouble(); double s = GetDouble(); printf("Quotient of %lf/%lf is %lf",r,s,FindQuo(r,s)); } #include<stdio.h> //for printf and scanf #include<stdlib.h> //for abs
void Greeting() { printf("Welcome to Absolute and Quotient evaluator "); } int GetInt() { int n; scanf("%d",&n); return n; } double GetDouble() { double n; scanf("%lf",&n); return n; } int FindAbsoluteValue(int arg1, int arg2) { return abs(arg1-arg2); } double FindQuo(double arg1, double arg2) { if(arg2==0) return 0.0; else return arg1/arg2; } void main() { Greeting(); //calls Greeting function printf("Enter first and second integer: "); //prompts for first and second integers int a = GetInt(); //calls GetInt function to read integers int b = GetInt(); printf("Absolute of %d-%d is %d",a,b,FindAbsoluteValue(a,b)); printf(" Enter third and fourth integer: "); int c = GetInt(); int d = GetInt(); printf("Absolute of %d-%d is %d",c,d,FindAbsoluteValue(c,d)); printf(" Enter first and second double values: "); double p = GetDouble(); //calls GetDouble function to read double values double q = GetDouble(); printf("Quotient of %lf/%lf is %lf",p,q,FindQuo(p,q)); printf(" Enter third and fourth double values: "); double r = GetDouble(); double s = GetDouble(); printf("Quotient of %lf/%lf is %lf",r,s,FindQuo(r,s)); }

Explanation / Answer

#include<stdio.h> //for printf and scanf

#include<stdlib.h> //for abs

// display a formal greeting to the user when he/she runs the program

void Greeting()

{

    printf("Welcome to Absolute and Quotient evaluator ");

}

// function to read an integer and return it

int GetInt()

{

    int n;

   

    // get user input

    scanf("%d",&n);

   

    // return the number

    return n;

}

// function to read an double and return it

double GetDouble()

{

    double n;

   

    // get user input

    scanf("%lf",&n);

   

    // return the number

    return n;

}

// calculate the absolute value of the difference of the two

int FindAbsoluteValue(int arg1, int arg2)

{

    // abs() function calculates the absolute value

    return abs(arg1-arg2);

}

// calculate the qoutient of two numbers

double FindQuo(double arg1, double arg2)

{

    // if the denominator is 0

    if(arg2==0)

        return 0.0;

   

    // divide the number and return the quotient

    else return arg1/arg2;

}

void main()

{

    // display the formal greeting

    Greeting(); //calls Greeting function

    printf("Enter first and second integer: "); //prompts for first and second integers

    // get user input

    int a = GetInt(); //calls GetInt function to read integers

   

    // get user input

    int b = GetInt();

   

    // display the absolute value of difference of a and b

    printf("Absolute of %d-%d is %d",a,b,FindAbsoluteValue(a,b));

    printf(" Enter third and fourth integer: ");

   

    // get user input

    int c = GetInt();

   

    // get user input

    int d = GetInt();

   

    // display the absolute value of difference of c and d

    printf("Absolute of %d-%d is %d",c,d,FindAbsoluteValue(c,d));

   

    printf(" Enter first and second double values: ");

    // get user input

    double p = GetDouble(); //calls GetDouble function to read double values

   

    // get user input

    double q = GetDouble();

   

    // calculate the qoutient and display the result

    printf("Quotient of %lf/%lf is %lf",p,q,FindQuo(p,q));

    printf(" Enter third and fourth double values: ");

   

    // get user input

    double r = GetDouble();

   

    // get user input

    double s = GetDouble();

   

    // calculate the qoutient and display the result

    printf("Quotient of %lf/%lf is %lf",r,s,FindQuo(r,s));

}