Homelurk halp?

having trouble writing a program that finds the lowest common multiple of 3 and 4 over 100
>
pls im new and come from html world so this is rocket siense

pls some help

>>>/sqt/
Also, do your own homework

if youre having trouble with this level of coding its about time to apply for ikea

post one example and ill guide you

first number greater than 100; divisble by both 3 and 4


>is that what you mean ?

If so,

Let i = 101.
Is 101 divisible by 12?
If yes, print i.
If no, increment i, back to step 1.

Woops, should be "is i divisible by 12"

12?

If a number is some multiple of a and b, then that number is also a multiple of a*b.

For instance, 36 is a multiple of 3 and 6, and also 18 (because 3*6 = 18).

>come from html

> checks every number in a loop
> doesn't simply calculate (floor(100/12)+1)*12

...

Since you'll find the solution in max 12 iterations, is efficiency really a concern?

Also, OP is a complete beginner. That wouldn't be a helpful reply at all.

factoring numbers is a np hard problem, don't bother doing it

Hey buddy here you go
#include "stdio.h"
int main(int argc, char* arvg[]){int OPKEK = 100;while(OPKEK%12!=0){OPKEK++;}printf("OPKEK%dOPKEK",OPKEK);}

better remove those magic numbers you got there. you dont want your code to be smelly right?

>HEY MOM LOOK AT THIS IM A HACKER I MADE A WEBSSITE

op here, best i come up with compiler does not like it ?

#include

int main()
{
int n = 100, a = 3, b = 4;

for(;;)
{
a*b > 100
printf("shit");
}
return(0);
}

if you want to be a programmer you have to learn math though.
If you are a beginner which doesn't even know simple math stuff, then you should learn math first.

that is an abomination of a C program

what wrong ?

holy kek op you just sit your ass down i've got some hat steamy meme code coming for you to turn in.

1. you have a endless loop
2. your are missing a ";"
3. "a*b > 100" does nothing
4. I cant imagine what you are doing

#include

int main(void)
{
int i;
for(i=1; i
are you trying to do this?

If OP wants to be a programmer, he should be conscious of how the efficiency of his program scales with input

It might not make a difference in this one case, but if you entered huge numbers, your program would have to iterate through millions of numbers while theirs would finish instantly

And you think he's at the level to understand or digest that? The problem is clearly for beginners and expects a solution involving loops and if statements.

Dear lord

Not Op.
But The result is 12.
What are you even trying to do?
How does printing out every number that isnt divisible by 3 and 5 makes sense.

Not only is your conditional check nowhere close to syntactically correct, it's also checking whether 12 is greater than 100.

Surely you know that 12 will NEVER be greater than 100, right?

Are you sure you're not OP? You seem to be just as new as him if you don't know what fizzbuzz is.

i posted this as an example because its similar

#include
#include


int main(int argc, char * argv[]){

int i = 102;
while(i % 4){
i += 3;
}

printf("The number is: %d \n", i);

return 0;
}

lol

Here op I made this for you. Turn it in.

I wrote this in a personal format which I've named "Closed Brackets".

#include "stdio.h"
#include "stdlib.h"
#define TYPE int
TYPE* redoc(TYPE *arr){
if(arr){/*do nothing*/}
else{return; }
int newsize = sizeof(arr)/sizeof(arr[0])-1;
TYPE *holder = (int*)malloc(sizeof(int)*newsize);
int i = 0;
for(;i< newsize-1;i++){
holder[i] = arr[i];
}free(arr);
return holder;
}int isdivThree(int check, TYPE* divT){
static int i =0;
if((((check %3) == (0)) && ((check >100) && (3>0)))){
/*added more parenthesis so that I could practice lisp*/
/*printf("The Number %d is divisible by three."check);*/
if(check!=0){
if(divT[(sizeof(divT)/sizeof(divT[0])) -1] == 0){
divT = redoc(divT);
divT[sizeof(divT)/sizeof(divT[0])-1]= check;
}return 1;
}}else{return 0;}
}int isdivFour(int check, TYPE* divF){if(check%4 == 0){divF = redoc(divF);divF[sizeof(divF)/sizeof(divF[0])-1] =check;return 1;
}else{return 0;}
}int main(int argc, char* arvg[]){
int* divT=(TYPE*)malloc(sizeof(TYPE)*1);
int* divF=(TYPE*)malloc(sizeof(TYPE)*1);
int OPFUCK = 100;
while(!isdivFour(OPFUCK,divF)||!isdivThree(OPFUCK,divT)){
OPFUCK++;
}printf("\nThe number, divisible by 4 and 3 is: \n%d \n",OPFUCK);
}

what are you even doing?

while(i % 4)

multiple (a, b) c = (,) (c % a == c % b) c
where % = mod

main = print . snd . head . filter fst $ map (multiple (3,4)) [100..]

Int i = 100;
while(i%12!=0)
i++;
Printf("Number: %d\n", i);

Why?
You are taking the answer for granted, your code makes no sense.
This is probably the expected solution:

#include

int main(void)
{
int i=0;
for(i=1; i

Matlab code:

lcm(3,4)

always happy to help.

i

what's wrong with it ?

that for is cancerous.
Use while, that's what it has been made for

while(i % 4)
is a retarded loop.
Do you even know what you are doing?

#include
int main() { printf("108"); }


Enjoy!

Its useless but if you were to use other numbers then 3 and 4 i wanted a guarantee that the loop will terminate within OPs limit.

>Use while, that's what it has been made for
No.
Why would I?

OP said it's supposed to look at numbers OVER 100.

not the guy who wrote it and it won't win any prizes for readability but other than that it does what it's supposed to so why is it retarded? do you even know what he's doing?

i = 104
i*4 = 0

104 is the answer! but its not

oh right.
#include

int main(void)
{
int i;
for(i=100; (i%4!=0 || i%3!=0); i++){}
printf("%d",i);
return 0;
}

>102 + 3 = 104

is this real bait?

different person but it really looks like you should be using while
this isnt python

it's because 12 is the least common multiple of 3 and 4. you wouldn't use 18 if the numbers were 3 and 6, you would use 6.