answersLogoWhite

0


Best Answer

/* To Get The LCM Of 15 Nos in C++/ C(Just Change cin to scanf & cout to printf) */

/* Developed By Kishore Kr. Banerjee - papillon_kish@Yahoo.com*/

#include <iostream.h>

#include <conio.h>

main()

{

int num[15],i,j,n1,n2,LCM,flag;

clrscr();

for(i=0;i<15;i=i+1)

{

cout<<"Enter No - "<<i+1<<"=";

cin>>num[i];

}

clrscr();

n1=num[0];

for(i=1;i<15;i=i+1)

{

n2=num[i];

LCM=1;

for(j=1;n1%j==0n2%j==0;j=j+1)

{

if(n1%j==0)

{

n1=n1/j;

flag=1;

}

if(n2%j==0)

{

n2=n2/j;

flag=1;

}

if(flag==1)

{

LCM=LCM*j;

}

}

LCM=LCM*n1*n2;

n1=LCM;

}

cout<<"the LCM ="<<LCM;

getch();

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: A program in C that accepts 15 different numbers and find the LCM and HCM?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


Write a Shell program to find the smallest number from a set of numbers?

k


Write a C program to find the square of two numbers?

Please visit http://talentsealed.blogspot.com/2009/10/to-find-sqaure-of-numbers-using-c.htmlfor the answer.


How many women with Aspergers Syndome get married and have families?

I don't know any numbers or statistics for this, but it is possible. I am single, but i have finally developed a close friendship with one person who understands and accepts me. It was possible to find him as a friend. It is also possible to find someone who accepts you just as much who will be a future husband.


Can you find any numbers that are divisible by four different prime numbers?

210


An example of a PASCAL program to find the average of a set of numbers?

how to get the arithmetic average on pascal


Write a cgi application which accepts three numbers from the used and display biggest number using get and post methods?

Find your own answers....sucks mahn


Write a C program to find the sum of all prime numbers?

Since there is an infinite set of prime numbers the answer would be infinity.


Numbers in all languages?

You can find the numbers in many different languages in the link below.


Write a program to find the product of two numbers using Halving and Doubling method?

i need this answer