Question: Assignment 0 This assignment is NOT graded but is required to make sure students completed the Lab tutorials and are able to use SageMath and

Assignment 0
This assignment is NOT graded but is required to make sure students completed the Lab tutorials
and are able to use SageMath and C. Once this tutorial is completed, students are expected to have
understood how to run C in Linux and use SageMath. Report your results in one file and submit to
Canvas. Include your name, Z-number, and assignment number in the assignment.
Part 1: Run the following code in C. Set first value as first 4 digits of your Z-number and the second
value as last 4 digits of your Z-number. Report the output.
#include
int main(){
int n1, n2, i, gcd;
printf("Enter two integers: ");
scanf("%d %d", &n1, &n2);
for(i=1; i <= n1 && i <= n2; ++i)
{
if(n1%i ==0 && n2%i ==0){
gcd = i;
}
}
printf("G.C.D of %d and %d is %d
", n1, n2, gcd);
return 0;
}
Part 2: Run the following function in SageMath replacing value1 and value 2 with the values
mentioned in part 1. Report the output and verify the results from part 1 are correct.
n1= value1
n2= value2
gcd(n1, n2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!