ECE347_HW10_C_language ECE347 - Extra HW on C language 1. Write a C language main function that multiplies two integers a and b, with the result being stored in a long integer. Use some arbitrary...

1 answer below »
HC12 and Code WarrierHomework on C language



ECE347_HW10_C_language ECE347 - Extra HW on C language 1. Write a C language main function that multiplies two integers a and b, with the result being stored in a long integer. Use some arbitrary numbers for testing. 2. Re-write the above problem such that the main function initializes a and b, then calls a function that uses a and b as input parameters, performs the multiplication, and returns the long result. 3. What is the Code Warrior name used to identify the data direction register, bit 6, on port P? 4. Write a simple C language function that initializes the GPIO bits on port B, such that bit 7 is an input with pullup enabled, bit 6 is an output, and no other bits are manipulated.
Answered Same DayApr 20, 2021

Answer To: ECE347_HW10_C_language ECE347 - Extra HW on C language 1. Write a C language main function that...

Ria answered on Apr 24 2021
132 Votes
solution/ece347hw10clanguage-solution.docx
ECE347 - Extra HW on C language
1. Write a C language main function that multiplies tw
o integers a and b, with the result being stored in a long integer. Use some arbitrary numbers for testing.
#include
int main()
{
    int a,b;        // two integer numbers
    long int c;        // two long integer numbers
    // get two numbers from user
    printf("Enter two integer numbers:\n");
    scanf("%d%d", &a, &b);
    // multiply two integers and store result into a long integer
    c = a * b;
    // show result
    printf("The result is: %li\n", c);
    return 0;
}
2. Rewrite the above problem such that the main function initializes a and b, then calls a function that uses a and b as input parameters, performs the multiplication, and returns the long result.
#include
long int multiplication(int a, int b)
{
    long int c;        // two long integer numbers
    c = a * b;        // multiply two integers
    return c;        // returns long integer
}
int main()
{
    int a,b;        // two integer numbers
    // get two numbers from user
    printf("Enter two integer numbers:\n");
    scanf("%d%d", &a, &b);
    // show result
    printf("The result is: %li\n", multiplication(a, b));
    return 0;
}
3. What is the Code Warrior name used to identify the data direction register, bit 6, on port P?
The...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here