how we do lcm of two no using c simple if while or for
statement
Answer / aditya goel
#include<stdio.h>
#include<conio.h>
main()
{
int lcm=1,a,b,c,d,x;
clrscr():
printf("Enter any two numbers:\n");
scanf("%d %d",&a,&b);
c=a;d=b;
x=(a<b)?a:b;
for(i=2;i<=x;i++)
{
if ((a%i==0) && (b%i==0))
{
lcm=lcm*i;c=c/i;d=d/i;
}
else if (a%i==0)
{
lcm=lcm*i;c=c/i
}
else if (b%i==0)
{
lcm=lcm*i;d=d/i;
}
}
lcm=lcm*c*d;
printf("lcm is %d",lcm);
getch();
}
| Is This Answer Correct ? | 3 Yes | 13 No |
If I have a char * variable pointing to the name of a function ..
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers
# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }
Can we declare function inside main?
What is c preprocessor mean?
main() { intx=2,y=6,z=6; x=y=z; printf(%d",x) }
5 Answers Amazon, HCL, Thought Works,
what is the difference between malloc() and calloc() function?
Explain how can I manipulate strings of multibyte characters?
How do I swap bytes?
What is the meaning of 2d in c?
How do you determine if a string is a palindrome?