/* দুই সংখ্যার লসাগু নির্ণয়*/
#include <stdio.h>
main()
{
int a, b, x;
printf("Enter the first integer number: \n");
scanf("%d", &a);
printf("Enter the second integer number: \n");
scanf("%d", &b);
if(a>b){
x=a;
}
else if(b>a){
x=b;
}
again:
if((x%a==0)&&(x%b==0)){
printf("LCM is %d \n", x);
}
else{
x=x+1;
goto again;
}
}
/* দুই সংখ্যার লসাগু নির্ণয়*/
#include <stdio.h>
main()
{
int a, b, i, flag=0;
printf("please enter first number\n");
scanf("%d", &a);
printf("please enter second number\n");
scanf("%d", &b);
for(i=1; i<=a*b&&flag==0;i=i+1)
{
if (i%a==0&&i%b==0){
flag=flag+1;
printf("LCM is %d",i);
}
}
}
/* তিন সংখ্যার লসাগু নির্ণয়*/
#include <stdio.h>
main()
{
int a, b, c, x;
printf("Enter the first integer number: \n");
scanf("%d", &a);
printf("Enter the second integer number: \n");
scanf("%d", &b);
printf("Enter the third integer number: \n");
scanf("%d", &c);
if((a>b)&&(a>c)){
x=a;
}
else if((b>a)&&(b>c)){
x=b;
}
else if((c>a)&&(c>b)){
x=c;
}
again:
if((x%a==0)&&(x%b==0)&&(x%c==0)){
printf("LCM is %d \n", x);
}
else{
x=x+1;
goto again;
}
}
/* তিন সংখ্যার লসাগু নির্ণয়*/
#include <stdio.h>
main()
{
int a, b, c, i, flag=0;
printf("please enter first number\n");
scanf("%d", &a);
printf("please enter second number\n");
scanf("%d", &b);
printf("please enter third number\n");
scanf("%d", &c);
for(i=1; i<=a*b*c&&flag==0;i=i+1)
{
if (i%a==0&&i%b==0&&i%c==0){
flag=flag+1;
printf("LCM is %d",i);
}
}
}
/* দুই সংখ্যার গসাগু নির্ণয়*/
#include <stdio.h>
main()
{
int a, b, x;
printf("Enter two integer number: \n");
scanf("%d %d", &a, &b);
if(a<b){
x=a;
}
else{
x=b;
}
for(; x>=1; x=x-1){
if((a%x==0)&&(b%x==0)){
printf("GCD is %d \n", x);
break;
}
}
}
/* দুই সংখ্যার গসাগু নির্ণয়*/
#include <stdio.h>
int main()
{
int a, b, x, gcd;
printf("Enter two integer number: \n");
scanf("%d %d", &a, &b);
if(a<b){
x=a;
}
else{
x=b;
}
for(; x>=1; x=x-1){
if((a%x==0)&&(b%x==0)){
gcd=x;
break;
}
}
printf("GCD is %d \n", gcd);
return 0;
}
/* দুই সংখ্যার গসাগু নির্ণয়*/
#include <stdio.h>
main()
{
int a, b, x;
printf("Enter the first integer number: \n");
scanf("%d", &a);
printf("Enter the second integer number: \n");
scanf("%d", &b);
if(a<b){
x=a;
}
else if(b<a){
x=b;
}
for(; x>=1; x--){
if((a%x==0)&&(b%x==0)){
printf("GCD is %d \n", x);
break;
}
}
}
/* তিন সংখ্যার গসাগু নির্ণয়*/
#include <stdio.h>
main()
{
int a, b, c, x;
printf("Enter the first integer number: \n");
scanf("%d", &a);
printf("Enter the second integer number: \n");
scanf("%d", &b);
printf("Enter the third integer number: \n");
scanf("%d", &c);
if(a<b&&a<c){
x=a;
}
else if(b<a&&b<c){
x=b;
}
else if(c<a&&c<b){
x=c;
}
for(; x>=1; x=x-1){
if((a%x==0)&&(b%x==0)&&(c%x==0)){
printf("GCD is %d \n", x);
break;
}
}
}
/* তিন সংখ্যার গসাগু নির্ণয়*/
#include <stdio.h>
int main()
{
int a, b, c, x;
printf("Enter the first integer number: \n");
scanf("%d", &a);
printf("Enter the second integer number: \n");
scanf("%d", &b);
printf("Enter the third integer number: \n");
scanf("%d", &c);
if(a<b&&a<c){
x=a;
}
else if(b<a&&b<c){
x=b;
}
else if(c<a&&c<b){
x=c;
}
again:
if((a%x==0)&&(b%x==0)&&(c%x==0)){
printf("GCD is %d \n", x);
}
else{
if(x>=1){
x=x-1;
goto again;
}
else{
printf("No Results Available");
}
}
return 0;
}
/*কোনো সংখ্যা মৌলিক কিনা নির্ণয়*/
Definition of prime number:
A natural number greater than one has not any other divisors except 1 and itself.
In other word we can say which has only two divisors 1 and number itself. For example: 5
Their divisors are 1 and 5.
Note: 2 is only even prime number.
#include<stdio.h>
main ()
{
int a,i,f;
printf("enter your number:\n");
scanf("%d", &a);
f=0;
for(i=2;i<=a/2;i++){
if (a%i==0){
f=1;
break;
}
}
if(f==0){
printf("%d is prime", a);
}
else{
printf("%d is nonprime", a);
}
}