answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,max,min,r;

printf("Enter the values of a,b");

scanf("%d%d",&a,&b);

if(a>b)

{

max=a;

min=b;

}

else

{

max=b;

min=a;

}

while((max%min)!=0)

{

r=max%min;

if(r==0)

{

break;

}

max=min;

min=r;

}

printf("GCD=%d",min);

getch();

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

#include< stdio.h>

#include< conio.h>

void main()

{

int a,b,c;

cout< < "Enter two nos : ;

cin>>a>>b;

c=a*b;

while(a!=b)

{

if(a>b)

a=a-b;

else

b=b-a;

}

cout< < "HCM \t= " < < a;

cout< < "LCM \t= " < < c/a;

getch();

}

This answer is:
User Avatar


how to write a programm to add number like123 in c language

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in c language that inputs 2 number and solve using euclidean algorithm?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between an algorithm and java code?

In Java programming language, an algorithm refers to a sequence of instructions that have been specified to undertake a particular task within a certain time. An algorithm can take no or several inputs but will generate at least one output.


What is fundamental algorithm?

Algorithm It is the combination of sequential steps (these steps can be calculations, data processing, and reasoning tasks) use to resolve a problem in a very simple and efficient way. It is designed most efficiently that it can be expressed within a finite amount of space and time. we can implement it in any programming language. Properties of an algorithm : following are the main properties of an algorithm:- An algorithm must have a unique name. It should have explicitly defined sets of inputs and output. Algorithm must be in sequential order with unambiguous operations. It must have some endpoint, i.e., it halts in a finite amount of time. Visit for basic information about algorithms----&gt; geeksjournal.in/2020/01/20/introduction-to-design-and-analysis-of-algorithm/


What type of error in an algorithm will produce unexpected results depending on the number that the user inputs?

Algorithms do not accept user input; they are not computer programs. All input to an algorithm is specified at the start of the algorithm along with any required preconditions and postconditions. If a required precondition is not specified or is specified incorrectly, then this could result in unexpected results (or undefined behaviour in programming terminology). The type of error in the algorithm is simply that the precondition was not specified.


How would you write a program that read an integer for display each of digit of integer in English?

Use an enum if you are using a c style language. Or a map data structure. Assign each integer an English value and then match it to what the user inputs.


How many inputs does a decision box in a program flow chart?

One or more (and it has two or more outputs).

Related questions

How do you make program specification?

you first of all state the function of the program. State the inputs that will be used,the algorithm and the outputs of the program.


What is the difference between an algorithm and java code?

In Java programming language, an algorithm refers to a sequence of instructions that have been specified to undertake a particular task within a certain time. An algorithm can take no or several inputs but will generate at least one output.


What are the two crucial factors that are used to evaluate the behavior of any implemented algorithm?

Time complexity and space complexity. More specifically, how well an algorithm will scale when given larger inputs.


What is fundamental algorithm?

Algorithm It is the combination of sequential steps (these steps can be calculations, data processing, and reasoning tasks) use to resolve a problem in a very simple and efficient way. It is designed most efficiently that it can be expressed within a finite amount of space and time. we can implement it in any programming language. Properties of an algorithm : following are the main properties of an algorithm:- An algorithm must have a unique name. It should have explicitly defined sets of inputs and output. Algorithm must be in sequential order with unambiguous operations. It must have some endpoint, i.e., it halts in a finite amount of time. Visit for basic information about algorithms----&gt; geeksjournal.in/2020/01/20/introduction-to-design-and-analysis-of-algorithm/


What is the input and output of kalman filter?

The Kalman filter is an algorithm to eliminate noise from statistical observations. The inputs and outputs are dependent on what you are applying it to.


What is cross products?

in mathematics the cross products are the binary operation on two vectors in a 3dimensional Euclidean space that results in another vector which is perpendicular to the containing the 2 inputs vector.


What are that attributes of algorithms?

Qualities of a Good Algorithm. Efficiency: A good algorithm should perform its task quickly and use minimal resources. Correctness: It must produce the correct and accurate output for all valid inputs. Clarity: The algorithm should be easy to understand and comprehend, making it maintainable and modifiable.


What is meaning of Test Benches in VHDL?

After compiling a hardware description language like VHDL, it is required to apply inputs to the program in order to obtain out puts. Applying the inputs involves initial conditions. As the systems designed using VHDL are electronic, the initial conditions plays a vital role. Hence, all these conditions along with the information as to where the input is expected to change from 1 to 0 or 0 to 1 is provided to the VHDL program. This is done in the form of a wave or another VHDL program. These are called VHDL test benches. In other words, test benches are the means of applying inputs to VHDL program.


What would be the worst case time complexity of the insertion sort algorithm if the inputs are restricted to permutation of N with at most n inversions?

&#415;(nlogn)


How do I write a pseudocode algorithm which inputs numeric scores and outputs how many of them are over 100. The end of the data is signalled by a user input of -1.?

101


What type of error in an algorithm will produce unexpected results depending on the number that the user inputs?

Algorithms do not accept user input; they are not computer programs. All input to an algorithm is specified at the start of the algorithm along with any required preconditions and postconditions. If a required precondition is not specified or is specified incorrectly, then this could result in unexpected results (or undefined behaviour in programming terminology). The type of error in the algorithm is simply that the precondition was not specified.


What are the main characteristics of algorithm explain with suitable example?

1. Finiteness : An algorithm must terminate after a finite number of steps and further each steps must be executable in finite amount of time. 2. Each step of an algorithm must be precisely defined; the action to be carried out must be rigorously and unambiguously specified for each case. 3. Input: An algorithm has zero or more, but only finite number of inputs. zero input example: ASCII chart of 0-255 4. Output: An algorithm has one or more output. 5. Effectiveness: Should be effective that means each of the operation to be performed in an algorithm must be sufficiently basic that it can, in principle, be done exactly and in a finite length of time, by a person using pencil and paper and should be computer programming language independent