Finding the LCM of a range of numbers

前端 未结 14 924
时光说笑
时光说笑 2020-12-08 05:03

I read an interesting DailyWTF post today, \"Out of All The Possible Answers...\" and it interested me enough to dig up the original forum post where it was submitted. This

14条回答
  •  星月不相逢
    2020-12-08 06:01

    Here is the solution using C Lang

    #include
        int main(){
        int a,b,lcm=1,small,gcd=1,done=0,i,j,large=1,div=0;
        printf("Enter range\n");
        printf("From:");
        scanf("%d",&a);
        printf("To:");
        scanf("%d",&b);
        int n=b-a+1;
        int num[30];
        for(i=0;ilarge){
                    large=num[i];
                }
            }
            div=0;
            for(i=2;i<=large;i++){
                for(j=0;j

提交回复
热议问题