---
title: "Discussion on \"C program to find the GCD and LCM using pointers\" | Hashnode"
description: "Discussion on \"C program to find the GCD and LCM using pointers\". Here is a C program to find the Greatest common devisor and the Least common multiple of a number.\n#include<stdio.h>\nvoid gcdlcm(int num1,int num2,int*gcd,int*lcm)\n{\n    int i,max;\n    max=(num1>num2)?num1:num2;//Simple way of saying if num1 is great..."
url: "https://hashnode.com/posts/c-program-to-find-the-gcd-and-lcm-using-pointers/65e6fe954853d0af56db5484"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [C program to find the GCD and LCM using pointers](https://gagang.hashnode.dev/c-program-to-find-the-gcd-and-lcm-using-pointers?utm_source=hashnode&utm_medium=feed)

Here is a C program to find the Greatest common devisor and the Least common multiple of a number. #include<stdio.h> void gcdlcm(int num1,int num2,int\*gcd,int\*lcm) { int i,max; max=(num1>num2)?num1:num2;//Simple way of saying if num1 is great...

Mar 5, 2024 · 1 min read · gagang.hashnode.dev  
Read the article

-   [#7daystreak](https://hashnode.com/tag/7daystreak)
-   [#crazyblogger](https://hashnode.com/tag/crazyblogger)
-   [#c](https://hashnode.com/tag/c)
-   [#gcd](https://hashnode.com/tag/gcd)
-   [#lcm](https://hashnode.com/tag/lcm)
-   [#beginners](https://hashnode.com/tag/beginners)

## Written by

[Gagan G Saralaya](https://hashnode.com/@GaganG)

@GaganG

  
[View profile](https://hashnode.com/@GaganG)

Just a coder building cool stuff.

I'm passionate about coding and enjoy working with embedded systems, app development, and compiler design.

## Responses 1

Markdown supported · ⌘↵ to post

[\--](https://hashnode.com/@myesolar)

[Mar 5, 2024](https://hashnode.com/posts/c-program-to-find-the-gcd-and-lcm-using-pointers/65e6fe954853d0af56db5484/comment/65e71994a23c71c02cb90994)

lcm is wrong lcm = (num times num2) / (\*\*gcd)
