Jo's aptitude classes Jo is an aptitude trainer. She takes classes for college students for placements. She teaches students to find out highest common factor of three numbers. She has given homework for them to find out the same. Kindly help her to check whether their answers are correct or not.
Answers
Answered by
2
Answer:give me the full code
Explanation:
Answered by
9
Answer:
Explanation:
#include<iostream>
int main()
{
int n1,n2,n3,n4;
std::cin>>n1>>n2>>n3>>n4;
int small=0;
int gcd=0;
if(n1<n2&&n1<n3)
{
small=n1;
}
else if(n2<n1&&n2<n3)
{
small=n2;
}
else
small=n3;
while(small>=1)
{
if(n1%small==0&&n2%small==0&&n3%small==0)
{
gcd=small;
break;
}
small--;
}
if(gcd==n4)
std::cout<<"Answer is correct.";
else
std::cout<<"Answer is wrong.";
}
Similar questions
Social Sciences,
5 months ago
History,
5 months ago
Social Sciences,
5 months ago
Hindi,
10 months ago
English,
10 months ago
Geography,
1 year ago