i need a program that prints out 1 2 3 1 2 3 1 2 3 if the input is 3
i've written this but doesnt work #include
int main(void) { int x; int i; int j; int y = 1; printf("Sayiyi giriniz: "); scanf("%d", &x); if(x < 2 || x > 40) { return 0; } for(i = 0; i < x; i++) { for(j = 0; j < x; j++) { printf("%d", &y); y++; } y = 1; printf("\n"); } return 0; }
pls help...
pic to lure neckbeards
Daniel Reed
>Sayiyi giriniz
What third world shitspeak is this?
Nathan Brooks
d-d-do my homework user
Logan Morris
shish kebab mate
greetings from arabia
Grayson Peterson
Looks like dirty wanabe - euro, paedophile kebab speak.
Aka Turkish
Austin Cook
correct
Asher Foster
if input == 3: print(”1 2 3\n"*3}
Hudson Reed
çek git
Owen Turner
tm
Colton Rogers
...
Elijah Russell
seems like Sup Forums changed a lot..
i'll give a shot to g/sqt/
Zachary Johnson
Well, it's a direct interpretation of what he said. He should have specified that he wants it to do different things for different inputs. Or, better yet, do his own homework and actually learn something.
The user who you replied to wasn't stupid, he's just making fun of op.
Ian Edwards
here ya go buddy boy #include int main(void) { int x; int i; int j; scanf("%d", &x); printf("printing that shit:\n"); if (x < 2 || x > 40) return 0; for (i = 0; i < x; i++) { for (j = 0; j < x; j++) { printf("%d ", j+1); } printf("\n"); } return 0; }
hopefully you feel silly now
Jordan Jackson
The printf in your loop has &y instead of just y.
Parker Kelly
Please don't shit up other boards with your 101 class questions. Spend five minutes looking at your own code and trying to understand it. You will be infinitely better off for it.
Cameron Lee
fucking hell
i was wondering why it was printing things that resemble a memory adress... fuck me
Liam Sullivan
this is C#, since you're a C smartass, you'll have no problems understanding this
This program could be done in 3 lines of Python code by a literal retard after 10 minutes of an online course.
C is fucking garbage.
Thomas Taylor
kek lets see you write that code
Christopher Howard
why didnt you escape the brackets in the next segment?
Gavin Gonzalez
the best solution, obviously pic related
Dylan Russell
You guys got universities?
Andrew Jones
not cool
Blake Powell
>string * 3 Wtf does this work in java lol
Benjamin Barnes
the first part of the s/// is a regexp, and brackets have a special meaning in regexps. The second is not a regexp, it's just text for substitution. Only a $n (where n is a small integer) would have a special meaning there. So brackets need not be escaped
Anthony Kelly
here c = 3 print((" ".join(map(str,range(1,c+1)))+"\n")*c)
C stands for cancer. If you are determined to get cancer use a decent cancer like D.
import std.stdio;
void main(){ write("Enter your loop size: "); int n; readf(" %s", &n); writeln();
for (int i=1; i
Dominic Lopez
So readable, your superior code
Joshua Taylor
nobody said it had to be readable
Dylan Harris
Spoonfeeding needs to be banned, all responses should have told OP to figure it out himself
Michael Bennett
C babbies need help
Jackson Cox
why do you need two for loops?
Christopher Parker
what's wrong with two for loops?
Ryan Perez
If you tried to commit shit like this I would bounce it back and then we'd all make fun of you during the 11:30 meeting.
Zachary Reed
O(N^2)
Gabriel Rivera
okay = input('enter 3') if okay == 3 then print('1 2 3') print('1 2 3') print('1 2 3') end
Easton Perry
Ignore me. I though the output was just one instance of "1 2 3" not multiple.
Lucas Reyes
I guess he means that it would be better to construct the string first, which is linear, and then print it N times. The total runtime is going to be linear.
Levi Torres
So what if you input 2?
Bentley Miller
>implying you can't do shitty oneliners in C #include int main() { int c = 3; for (int i=0;i