Search
 
SCRIPT & CODE EXAMPLE
 

C

gcd and lcd in c

#include <stdio.h>
//here is a c programme which can find GCD and LCD

int main(){

    int n1,n2,num1,num2,rem,gcd,lcm;

    printf("Enter first and second number number (3,4) : 
");
    scanf("%d %d",&num1,&num2);
    n1=num1;
    n2=num2;

    while(n2!=0){
        rem=n1%n2;
        n1=n2;
        n2=rem;

    }

    gcd=n1;
    lcm=(num1*num2)/gcd;

    printf("GCD of %d and %d is %d
",num1,num2,gcd);
    printf("LCM of %d and %d is %d
",num1,num2,lcm);


    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: Palindrome number in c program 
C :: c long to string 
C :: delay in c programming for windows 
C :: unsigned char c programming 
C :: c concatenate and allocate string 
C :: Installing Tailwind 
C :: calculate median 
C :: stdio.h 
C :: faire une facture en langage c 
C :: size of pointer in c 
C :: leggere stringhe con spazio in mezzo c 
C :: what is type casting in c programming 
C :: fread 
C :: Create the static library libmy.a containing all the functions listed below: 
C :: working outside of application context 
C :: C# special character display 
C :: c defined value sum 
C :: example of header file in c 
C :: predefined macros 
C :: Number 10 
C :: how to only show tenths place in c 
C :: semicolong after for() loop stackoverflow 
C :: Combine two sentences into one langage c 
C :: #define _TIMESPEC_DEFINED struct timespec { time_t tv_sec; long tv_nsec; }; 
C :: deepak 
C :: bc1q9rfht42zayr3yvxqjw8tm6v3tkwl93t35gegxl 
C :: (avar == 1) ? (bvar == 2 ? result = 3 : (result = 5);) : (result = 0); 
C :: algorithm for sorting numbers in ascending order 
C :: program to merge two strings in c 
C :: fread condition 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =