Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Co- Prime check in an easy approach using C #6568

Open
ShuvamBag opened this issue Oct 9, 2022 · 5 comments
Open

Co- Prime check in an easy approach using C #6568

ShuvamBag opened this issue Oct 9, 2022 · 5 comments

Comments

@ShuvamBag
Copy link

ShuvamBag commented Oct 9, 2022

#include<stdio.h>

int coprime(int num1, int num2)
{
int min, count, flag = 1;

min = num1 < num2 ? num1 : num2;  

for(count = 2; count <= min; count++)  
{  
    if( num1 % count == 0 && num2 % count == 0 )  
    {  
        flag = 0;  
        break;  
    }  
}  

return(flag);  

}

int main()
{
int n1, n2;

printf("Enter 2 positive numbers\n");  
scanf("%d%d", &n1, &n2);  

if( coprime(n1, n2) )  
{  
    printf("%d and %d are co-prime numbers.\n", n1, n2);  
}  
else  
{  
    printf("%d and %d are not co-prime numbers.\n", n1, n2);  
}  

return 0;  

}

// This is a co- prime number check program made using c.

@ShuvamBag ShuvamBag changed the title Co- Prime check in an easy approach using C++ Co- Prime check in an easy approach using C Oct 9, 2022
@HridoyHazard
Copy link
Contributor

what do you want? if you want to contribute plz make a pr on this issue. thanks

@AdityaShaw1
Copy link

can u pls assign me to this issue??

@pinak01
Copy link

pinak01 commented Oct 8, 2023

i want to contribute in this

@sakshams23
Copy link

hello sir, I would like to contribute in this issue. Please assign this to me.

@PrathamKumar125
Copy link

@AdiChat @ShuvamBag please review the merged code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants