C programming code to find hcf and lcm
#include <stdio.h>
int main() {
int a, b, x, y, t, gcd, lcm;
printf("Enter two integers\n");
scanf("%d%d", &x, &y);
a = x;
b = y;
while (b != 0) {
t = b;
b = a % b;
a = t;
}
gcd = a;
lcm = (x*y)/gcd;
printf("Greatest common divisor of %d and %d = %d\n", x, y, gcd);
printf("Least common multiple of %d and %d = %d\n", x, y, lcm);
return 0;
}
#include <stdio.h>
int main() {
int a, b, x, y, t, gcd, lcm;
printf("Enter two integers\n");
scanf("%d%d", &x, &y);
a = x;
b = y;
while (b != 0) {
t = b;
b = a % b;
a = t;
}
gcd = a;
lcm = (x*y)/gcd;
printf("Greatest common divisor of %d and %d = %d\n", x, y, gcd);
printf("Least common multiple of %d and %d = %d\n", x, y, lcm);
return 0;
}
C program to find hcf and lcm using recursion
#include <stdio.h>
long gcd(long, long);
int main() {
long x, y, hcf, lcm;
printf("Enter two integers\n");
scanf("%ld%ld", &x, &y);
hcf = gcd(x, y);
lcm = (x*y)/hcf;
printf("Greatest common divisor of %ld and %ld = %ld\n", x, y, hcf);
printf("Least common multiple of %ld and %ld = %ld\n", x, y, lcm);
return 0;
}
long gcd(long a, long b) {
if (b == 0) {
return a;
}
else {
return gcd(b, a % b);
}
}
#include <stdio.h>
long gcd(long, long);
int main() {
long x, y, hcf, lcm;
printf("Enter two integers\n");
scanf("%ld%ld", &x, &y);
hcf = gcd(x, y);
lcm = (x*y)/hcf;
printf("Greatest common divisor of %ld and %ld = %ld\n", x, y, hcf);
printf("Least common multiple of %ld and %ld = %ld\n", x, y, lcm);
return 0;
}
long gcd(long a, long b) {
if (b == 0) {
return a;
}
else {
return gcd(b, a % b);
}
}
C program to find hcf and lcm using function
#include <stdio.h>
long gcd(long, long);
int main() {
long x, y, hcf, lcm;
printf("Enter two integers\n");
scanf("%ld%ld", &x, &y);
hcf = gcd(x, y);
lcm = (x*y)/hcf;
printf("Greatest common divisor of %ld and %ld = %ld\n", x, y, hcf);
printf("Least common multiple of %ld and %ld = %ld\n", x, y, lcm);
return 0;
}
long gcd(long x, long y) {
if (x == 0) {
return y;
}
while (y != 0) {
if (x > y) {
x = x - y;
}
else {
y = y - x;
}
}
return x;
}
#include <stdio.h>
long gcd(long, long);
int main() {
long x, y, hcf, lcm;
printf("Enter two integers\n");
scanf("%ld%ld", &x, &y);
hcf = gcd(x, y);
lcm = (x*y)/hcf;
printf("Greatest common divisor of %ld and %ld = %ld\n", x, y, hcf);
printf("Least common multiple of %ld and %ld = %ld\n", x, y, lcm);
return 0;
}
long gcd(long x, long y) {
if (x == 0) {
return y;
}
while (y != 0) {
if (x > y) {
x = x - y;
}
else {
y = y - x;
}
}
return x;
}
Asp dot net Tutorial Part -10 Out now
https://youtu.be/Zlu8aKaOPgA
https://youtu.be/Zlu8aKaOPgA
YouTube
#10 ASP.NET Course 2022 | Page renders into HTML, coding Technique & server controls | coderbaba
#coderbaba
developed ASPdotnet website working with web page & server control .
topics:
ASP.NET Renders HTML
Response.write()
Coding Techniques in ASP.NET
Developing Web Pages using Visual Studio
Adding a Web Form in our project
Working with…
developed ASPdotnet website working with web page & server control .
topics:
ASP.NET Renders HTML
Response.write()
Coding Techniques in ASP.NET
Developing Web Pages using Visual Studio
Adding a Web Form in our project
Working with…
Const char *p , char const *p What is the difference between the above two?
1) const char *p - Pointer to a Constant char ('p' isn't modifiable but the pointer is)
2) char const *p - Also pointer to a constant Char
However if you had something like:
char * const p - This declares 'p' to be a constant pointer to an char. (Char p is modifiable but the pointer isn't)
TCS TECHNICAL INTERVIEW QUESTIONS:
Write a program to find factorial of a number using recursive function.
• Describe 2 different ways to concatenate two strings.
• Give syntax for SQL and ORACLE joins.
• How is modularity introduced in C++?
• What is the difference between a Stack and a Queue.
• Give example to differentiate between call by value and call by reference.
• Why the usage of pointers in C++ is not recommended ?
• What do you mean by Data mining?
• Write a program to reverse a string.
• Describe these concepts: Polymorphism, Inheritance and Abstraction.
• What is full form of SMAC? Discuss few about it.
• What is cloud computing? Give some of its applications in real world.
• What are stacks? Give some of its applications.
• One rectangular plate with length 8inches,breadth 11 inches and 2 inches thickness is there. what is the length of the circular rod with diameter 8 inches and equal to volume of rectangular plate?
• How would you connect 8 dots with 3 lines.
• Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.
• Can you declare a private method as static?
• How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?
• Differentiate between copy and default constructor.
• What is #ifdef ? What is its application?
• You are given a singly linked list. How would you find out if it contains a loop or not without using temporary space?
• A person was fined for exceeding the speed limit by 10 mph. Another person was also fined for exceeding the same speed limit by twice the same. If the second person was travelling at a speed of 45 mph. find the speed limit .
• What are different errors encountered while complying?
• How would you implement two stacks using a single array?
• Difference between keyword and identifier.
• What is the Big-O Notation?
• What do you understand by garbage collection in Java? Can it be forced to run?
• What happens if an array goes out-of-bounds?
• What is the role of C++ shorthand’s?
• Discuss the function of conditional operator, size of operator and comma operator with examples.
• Describe friend function & its advantages.
• Differentiate between null and void pointers.
• Write a program to add three numbers in C++ utilizing classes.
• Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
• Explain debugger.
• What are the different types of sorting? Explain the difference between them.
• What is meant by entry controlled loop? What all C++ loops are exit controlled?
Follow @coder_baba
1) const char *p - Pointer to a Constant char ('p' isn't modifiable but the pointer is)
2) char const *p - Also pointer to a constant Char
However if you had something like:
char * const p - This declares 'p' to be a constant pointer to an char. (Char p is modifiable but the pointer isn't)
TCS TECHNICAL INTERVIEW QUESTIONS:
Write a program to find factorial of a number using recursive function.
• Describe 2 different ways to concatenate two strings.
• Give syntax for SQL and ORACLE joins.
• How is modularity introduced in C++?
• What is the difference between a Stack and a Queue.
• Give example to differentiate between call by value and call by reference.
• Why the usage of pointers in C++ is not recommended ?
• What do you mean by Data mining?
• Write a program to reverse a string.
• Describe these concepts: Polymorphism, Inheritance and Abstraction.
• What is full form of SMAC? Discuss few about it.
• What is cloud computing? Give some of its applications in real world.
• What are stacks? Give some of its applications.
• One rectangular plate with length 8inches,breadth 11 inches and 2 inches thickness is there. what is the length of the circular rod with diameter 8 inches and equal to volume of rectangular plate?
• How would you connect 8 dots with 3 lines.
• Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.
• Can you declare a private method as static?
• How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?
• Differentiate between copy and default constructor.
• What is #ifdef ? What is its application?
• You are given a singly linked list. How would you find out if it contains a loop or not without using temporary space?
• A person was fined for exceeding the speed limit by 10 mph. Another person was also fined for exceeding the same speed limit by twice the same. If the second person was travelling at a speed of 45 mph. find the speed limit .
• What are different errors encountered while complying?
• How would you implement two stacks using a single array?
• Difference between keyword and identifier.
• What is the Big-O Notation?
• What do you understand by garbage collection in Java? Can it be forced to run?
• What happens if an array goes out-of-bounds?
• What is the role of C++ shorthand’s?
• Discuss the function of conditional operator, size of operator and comma operator with examples.
• Describe friend function & its advantages.
• Differentiate between null and void pointers.
• Write a program to add three numbers in C++ utilizing classes.
• Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
• Explain debugger.
• What are the different types of sorting? Explain the difference between them.
• What is meant by entry controlled loop? What all C++ loops are exit controlled?
Follow @coder_baba
GYM Management System Project in VB .NET, SQL SERVER Database with source code & Reports
download and run
https://imojo.in/297xtsa
download and run
https://imojo.in/297xtsa
Downloads free website template:
1-https://www.free-css.com
2-https://www.tooplate.com
3-https://nicepage.com
4-https://templatemo.com
5-https://www.w3schools.com
1-https://www.free-css.com
2-https://www.tooplate.com
3-https://nicepage.com
4-https://templatemo.com
5-https://www.w3schools.com