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

Please do Question 4 e Chegg Study! Guided S:x\\eComputer Science questx/D Assig

ID: 3884080 • Letter: P

Question

Please do Question 4

e Chegg Study! Guided S:xeComputer Science questx/D Assignment 4.pdf × Secure https://app.lms unimelb.edu.au/bbcswebdav/pid-5834078-dt content-rid-242941412/courses/ENGR100032017 SM2/Assignment 4.pdf : Apps G Google - My Home-Blackbo Login-The Universi: Watch Game of Thro Assignment 4.pdf 5 1 7 1 if the speed is supersonic Question 4 10 Marks] A Pythagorean triple is a set of positive integers (a, b, c) such that: Write a function isPythag that with the following signature. function p = 1sPythag(a, b, c) Inputs: a, b, c in the same order as specified in the problem statement Output:P 1 the sides form a Pythagorean triangle 0 the sides do not form a Pythagorean triangle (inputs are valid) -1 the inputs are not valid - they are not positive integers Question 5 10 Marks] Biomedical engineers are developing an insulin pump for diabetics. To do this, it is important to understand how insulin is cleared from the body after a meal. The concentration of insulin 2-36 AM 5/09/2017 2 Type here to search

Explanation / Answer

Algorithm :

isPythag(a,b,c)

{

        if ((a<0)||(b<0)||(c<0))
        {
                return -1;   //As the values of the sides are not valid i.e; they are negative.
        }
        a=a*a;
        b=b*b;
        c=c*c;
        if(((a+b)==c)||((a+c)==b)||((b+c)==a))
        {
                return 1;
        }
        else
        {
                return 0;
        }
}

C code:

#include <stdio.h>

int isPythag(int a,int b,int c)
{
        if ((a<0)||(b<0)||(c<0))
        {
                return -1;   //As the values of the sides are not valid i.e; they are negative.
        }
        a=a*a;
        b=b*b;
        c=c*c;
        if(((a+b)==c)||((a+c)==b)||((b+c)==a))
        {
                return 1;
        }
        else
        {
                return 0;
        }
}
int main()
{
        int a,b,c;
        printf("Enter the value of a,b and c respectively : ");
        scanf("%d %d %d",&a,&b,&c);
        printf("%d",isPythag(a,b,c));
        return 0;
}