R
RadiationX
I have to solve the following problem:Write a program that accepts two
integers, and determines if the second is a factor (is evenly divisible
into) the first. Here is the code i have so far.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a; //dividend
int b; //divisor
int c;
c==0;
printf("<------The Factoring Machine------->\n");
printf("\nPlease enter an integer followed by\n");
printf("a space and then the possible factor integer.\n");
printf("For exampe: [a b] is the correct format.\n");
scanf("%d%d", &a, &b);
c == a/b;
if(a%b==0)
{
printf("\n %d is a factor of %d\n", b, a);
printf("\nThe other factor is %d\n", c);
}
else
{
printf("\n%d is not a factor of %d\n",b,a);
}
system("PAUSE");
return 0;
}
why is the %d in the second printf not outputting the value of variable
c?
This should be the other factor.
integers, and determines if the second is a factor (is evenly divisible
into) the first. Here is the code i have so far.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a; //dividend
int b; //divisor
int c;
c==0;
printf("<------The Factoring Machine------->\n");
printf("\nPlease enter an integer followed by\n");
printf("a space and then the possible factor integer.\n");
printf("For exampe: [a b] is the correct format.\n");
scanf("%d%d", &a, &b);
c == a/b;
if(a%b==0)
{
printf("\n %d is a factor of %d\n", b, a);
printf("\nThe other factor is %d\n", c);
}
else
{
printf("\n%d is not a factor of %d\n",b,a);
}
system("PAUSE");
return 0;
}
why is the %d in the second printf not outputting the value of variable
c?
This should be the other factor.