The following program uses function multiple to determine if the integer entered
ID: 3819741 • Letter: T
Question
The following program uses function multiple to determine if the integer entered from the keyboard is a multiple of some integer X. Examine the function multiple, then determine X's value. Make sure you test the code with your compiler.//ex10_16. c This program determines whether a value is a multiple of X. #include int multiple(int num);//prototype int main(void) int y;//y will hold an integer entered by the user puts ("Enter an integer between 1 and 32000:"); scanf ("%d'', &y;);//if y is a multiple of X if (multiple(y)) {}//end if else {printf("%d is a multiple of X n", y);}//end if printf("%d is not a multiple of X ", y);}//end else}//end main//determine whether num is a multiple of X int multiple(int num) {int i;//counter int mask = 1;//initialize mask int mult 1;//initialize mult for (i = 1; iExplanation / Answer
#include <stdio.h>
int multiple(int num);
int a[32000];
int main()
{
int y,x,i;
puts("Enter an integer between 1 and 32000");
scanf("%d",&y);
multiple(y);
printf("%d is a multiple of is:",y);
if(x>0)
{
for(i=1;i<=10;i++)
{
if(a[i]!=0)
{
printf("%d ",a[i]);
}
}
}
else
printf("%d is not a multiple of is:",y);
return 0;
}
int multiple(int num)
{
int i;
if(num==0)
{
return 0;
}
for(i = 1 ; i <=10 ; i++)
{
if(num%i== 0)
a[i]=i;
//printf("%d ", i) ;
else
a[i]=0;
}
return 1;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.