You should be able to solve this

you should be able to solve this

package main

import “fmt”

func main() {
fmt.Println(“Maki!!!)
}

yw

Maki a shit

I'm able to solve that

I too am able to solve that

thats not what the problem was at all!

Is kurisu sick today or something? Why is this retard asking me to do trivial shit?

updoc

this desu

Someone who's taken a single programming class can do this shit

Why is maki such a fucking retard

STOP BULLYING MAKI

seeing a lot of RUDE posts and not a lot of answers desu

Maki is a rotten tomato!!!!!!

SHUT

import makicopyspam

int k = 1;

for (int i = 1; i

...

if youre too smart to do the triangle problem you can do the one from yesterday where you change an arbitrary signed integer from decimal to binary and return the two's complement but everyone in that thread just wanted to quibble about my terminology and didnt write a program

i did that yesterday
make a new problem for me immediately you fucking slut

no! wait until tomorrow and stop being rude!

Everybody wanted to quibble because your terminology was legitimately unclear and confusing. The challenge became something quite different depending on how one interpreted your words, and the obvious interpretation was incoherent.

the fuck up, stanky ass ho bitch
new problem NOW

#include

void main(void)
{
int i, j;
int num = 1;

for (i = 0; i < 5; ++i) {
for (j = i; j >= 0; --j)
printf("%d ", num++);
printf("\n");
}
}

Can you please post the image?

>LWA

>lil bitch poster
(you)

[spoiler]
int current;
int lineBreak;
int lineN;
int N = 80;

for( current = lineBreak = lineN = 1 ;
current < N+1 ;
current++ )
{
printf("%d ",current);
if(current == lineBreak)
{
putchar('\n');
lineN++;
lineBreak = current + lineN;
}
}
[/spoiler]

At least is readable
t. mathlet

KEK
int current;
int lineBreak;
int lineN;
int N = 80;

for( current = lineBreak = lineN = 1 ;
current < N+1 ;
current++ )
{
printf("%d ",current);
if(current == lineBreak)
{
putchar('\n');
lineN++;
lineBreak = current + lineN;
}
}

This is so fucking easy, I'm not even going to bother.

PROGRAM MAKI
DO I = 1, 5, 1
DO J = 1, I, 1
WRITE(*,*) I * (I - 1) / 2 + J
END DO
END DO
END PROGRAM MAKI

Don't worry user, she was just out to lunch.

umm BRAAPPP left one

8 6 7 5 3 0 9
xD

the ping pong ball side will lower

delet this right now

Shit you got me

#include

int main(int argc, char* argv[]){
int h = atoi(argv[1]);
int l = 1;
int k;
int i;
int t = 1;
for(k = 0; k < h; k++){
for(i = 0; i < l; i++){
printf("%d ", t);
t++;
}
l++;
printf("\n");
}
}

t. brainlet

#include

int main()
{
int r, n;
printf("%s", "Enter the number of rows in your triangle: ");
scanf("%d", &r);
if (r != 5) {
puts("undefined behaviour");
return 1;
}
n = 0;
for (int i = 1; i

...

#include
#include

int main() {
int row, current_num, numbers_in_row, user_num;
char buf[100];

printf("Enter the number of rows in your triangle: ");
user_num = atoi(fgets(buf, sizeof buf, stdin));

current_num = 1;
for (row = 0; row

Wait!
Presuming both balls are the same size:

Left side: all forces contained within the system; force is acting on this side is just the weight of the water + ping pong ball

Right side: All the water weight is supported by the lever + a portion of the steel ball's weight. The portion of the steel ball's weight carried is carried by the buoyancy force for the ball's size: (water density) * (gravitational constant) * (volume of the ball)

Given the density of the ping pong ball is less than that of water's, I'd argue the right side will go down:
((water mass) + (ping pong density)*(volume of ball)) * (gravitational constant) < ((water mass) + (water density)*(volume of ball)) * (gravitational constant)

I know there's formatting I could've used, but I'm piece of garbage

#include

int sumto(int n)
{
int sum = 0;
for (int i = 0; i < n; i++) {
sum += i;
}
return sum;
}

int main()
{
int r;
printf("%s", "Enter the number of rows in your triangle: ");
scanf("%d", &r);
for (int i = 1; i

You're supposed to be accepting input.

>taking the input and immediately assuming it is an integer
Fail.

>no "uwu"
nah I'm not solving it

import strutils

for i in 1.. stdin.readLine.parseInt:
for j in 1..i:
stdout.write j, " "
echo()
that's why they pay me big bucks

Because im retarded, fuck
import strutils

var n = 1
for i in 1.. stdin.readLine.parseInt:
for j in 1..i:
stdout.write n, " "; inc n
echo()

#include
#include
#include
#include

void NumberTriangle(std::size_t Rows);

int main(int argc, char* argv[])
{
if( argc < 2 )
{
return EXIT_FAILURE;
}
NumberTriangle(
std::strtoull(argv[1],nullptr,10)
);
return EXIT_SUCCESS;
}

void NumberTriangle(std::size_t Rows)
{
std::size_t Sum = 0;
for( std::size_t i = 1; i

Maki is so cute.

def row(n):
a = int(0.5 * (n**2 - n + 2))
return range(a, a+n)

The rest is left as an exercise for the reader.

# NumberTriangle.py
var = raw_input("Enter the number off rows in your triangle: ")
max = int(var)
count = 1
num = 0
while (count

I want to solve Maki with my dick if you know what I mean

#!/usr/bin/env python3

user_int = int(input("Enter the number of rows in your triangle: "))

start = 1
end = 1

for i in range(user_int+ 1):
start = end
end = start + (i * 1)
for j in range(start, end):
print(j, end=" ")
print()

What would your input variable be?

Ez

def count():
x = 1
while True:
yield x
x += 1

n = int(input("Enter the number of rows in your triangle: "))
print()
c = count()
t = [[next(c) for col in range(row+1)] for row in range(n)]
print("\n".join(map(lambda r: " ".join(map(str, r)), t)))

I want to touch maki's legs

gen :: (Enum t, Num t) => t -> [[t]]
gen i = map (\(x, y) -> [x+1..y]) $ (\a -> zip a (tail a)) $ scanl (+) 0 [1..i]

triangle :: (Show a, Num a, Enum a) => a -> IO ()
triangle i = sequence_ $ gen i >>= \a -> map (\a -> putStr (show a) >> putStr " ") a ++ [putStr "\n"]

main = do
putStr "number of rows?:"
s

...

...

>that little heart
Aww

f x = map (take x ([(sum [1..x-1])+1..])) [1..x]
[\code]

...

func Maki(_ input: Int) {
var startNum = 1
for i in 1...input {
for _ in 1...i {
print(startNum, terminator: " ")
startNum += 1
}
print()
}
}

C89 is a meme

I actually solved that one 4 years ago in my first year.

Post it faggot. I'm up for a challenge

ok

Why? What else could it be!

>someone accidentally presses a character
>hit enter
>program breaks

...

I suck at prolog
sumfromto(End, End, End).

sumfromto(Start, End, Sum) :- Next is Start+1,
sumfromto(Next, End, NextSum),
Sum is Start+NextSum.

rowhelper(LastCol, Number, LastCol) :- write(Number), write('\n').

rowhelper(LastCol, Number, Col) :- write(Number), write(' '),
NextNumber is Number+1,
NextCol is Col+1,
rowhelper(LastCol, NextNumber, NextCol).

row(Count, Start) :- rowhelper(Count, Start, 1).

trianglehelper(Height, Number, Height) :- row(Height, Number).

trianglehelper(Row, Number, Height) :- row(Row, Number),
NextRow is Row+1,
sumfromto(1, Row, Sum),
NextNumber is Sum+1,
trianglehelper(NextRow, NextNumber, Height).

triangle(Height) :- trianglehelper(1, 1, Height).

%:- row(1, 1),
% row(2, 2),
% row(3, 4),
% row(4, 7),
% row(5, 11),
% halt.

:- write('Enter the number of rows in your triangle: '),
read(Height),
triangle(Height),
halt.

Right side will go down.

def print_nums(n):
print()
l=1
for i in range(n):
k = ""
for j in range(i + 1):
k += str(l)+" "
l += 1
print(k)
print_nums(int(input("Enter the number of rows in your triangle: ")))

I forgot a comment
sumfromto(End, End, End).

sumfromto(Start, End, Sum) :- Next is Start+1,
sumfromto(Next, End, NextSum),
Sum is Start+NextSum.

rowhelper(LastCol, Number, LastCol) :- write(Number), write('\n').

rowhelper(LastCol, Number, Col) :- write(Number), write(' '),
NextNumber is Number+1,
NextCol is Col+1,
rowhelper(LastCol, NextNumber, NextCol).

row(Count, Start) :- rowhelper(Count, Start, 1).

trianglehelper(Height, Number, Height) :- row(Height, Number).

trianglehelper(Row, Number, Height) :- row(Row, Number),
NextRow is Row+1,
sumfromto(1, Row, Sum),
NextNumber is Sum+1,
trianglehelper(NextRow, NextNumber, Height).

triangle(Height) :- trianglehelper(1, 1, Height).

:- write('Enter the number of rows in your triangle: '),
read(Height),
triangle(Height),
halt.

>prolog
Literally why
I'm having a Prolog exam on my uni soon and can't stand this shit
Prolog is a fucking meme

Late to the party, but
#!/usr/bin/env python

import sys

def main():
if len(sys.argv) != 2:
sys.stderr.write('Use as ' + sys.argv[0] + ' \n')
exit(1)
rows = int(sys.argv[1])
columns = 1
num = 1
for i in range(rows):
for j in range(columns):
print(str(num), end=' ')
num += 1
columns += 1
print('\b\n', end='')

if __name__ == '__main__':
main()

>why
Prolog is neat once you get how it works

#include

main(){
printf("Enter the numbers of rows in your triangle: 5\n");
printf("1\n2 3\n4 5 6\n7 8 9 10\n11 12 13 14 15\n");

printf("\n\n\n\n\n\n\n\n\n");
printf("anyone answering 'echo\"Enter etc etc...\"' will\nbe subject to a fine of $5, payable to the\nElectronic Frontier Foundation");
}

Here you go, OP.

>current state of Sup Forums
I'm sincerely hoping this is some kind of weird bait

>op here
>just had some fucks do my homework for me

>homework is in any language of your choice

This bait is even worse..

>say "any language of choice" in the op knowing that my assignment is bound to be one of the 12 meme languages that would be used
>the perfect cover to hide the fact that i just had a thread do my homework for me

Literally just put a random google-search anime girl and a homework problem next to it and you can get Sup Forums to do it for you

...

Apart from that being entierly subjective, is there any actual use for Prolog anymore? If I'm not mistaken, it was targeted for AI stuff, but isn't AI nowadays mostly done in Python?

I love Maki

>you should be able to solve this
I'm used to this phrase being preceded by either an unsolvable question or one that I'd have to check wikipedia to know about, and then not understand.

...

>is there any actual use for {insert language here} anymore?
With that kind of thinking you will end up using Java or something everywhere.
The nice thing about non imperative, non object oriented languages languages is that they make you think in an original way and learn to approach problems differently.
This makes you appreciate programming and you will become a better programmer in the languages that the "market" wants.
Or I may be just naive.
>isn't AI nowadays mostly done in Python?
I don't know about Python exactly but I think AI nowadays is all about neural networks.
Prolog is about a traditional approach to AI that mostly failed and isn't in fashion anymore.
But Lisp mostly failed in AI too but it gave us Scheme and functional programming, I wish we had more failures like this.

(print'Enter the number of rows in your triangle: ';->(rows){(1..rows).each_with_index{|r,i|(0..i).map{|z|print i+=1,' '};puts''}}).(gets.to_i)

Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def main():
... number = int(input("Enter the number of rows in your triangle: "))
... j = 1
... for i in range(1, number+1):
... k=j
... while j>> main()
Enter the number of rows in your triangle: 5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
>>>

console.log(Array.from({length: process.argv[1]}).map((a,i)=>Array.from({length: i+1}).map((b,j)=>0.5*((i+1)**2-i+1)+j).join(" ")).join("\n"))

$ node maki.js 5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

#include

void main(void)
{
int rows;
int shownumber = 0;

printf("Enter the number of rows in your triangle (default 5): ");
scanf("%d", &rows);
for(int currentrow = 1; currentrow

#include
int main(){
int input, i, j;
printf("Enter the number of rows in your triangle: ");
scanf("%d", &input);
for(i = 1; i

Here's your homework:
main :: IO()
main = mapM_ print $ scanl (\acc x -> [last acc + 1..sum [1..x]]) [1] [2..5]

Having a separate shownumber variable is unnecessary, see

how do you even derive that

#lang racket/base
(define (maki)
(display "Enter # of rows: ")
(flush-output)
(define n (read))
(define k 0)
(for ([i (in-range n)])
(for/list ([_ (in-range (add1 i))])
(set! k (add1 k))
(printf "~a " k))
(newline)))

def pyramid(n):
c = 1
l = 1
while c < n:
for i in range(0,l):
print(c, end=" ")
c += 1
print()
l += 1

pyramid(15)

Did you test your program? It is valid for input = 2 but fails past that.

>using 2 loops
why?
#include

int main(){

int r;

printf("Enter the number of rows in your triangle: ");
scanf("%d", &r);
printf("\n");

int nums = (r * 3) + 1;
int max_width = 1;
int crrnt_width = 0;

for (int n = 1; n != nums; n++){

printf("%d ", n);
crrnt_width++;

if (max_width == crrnt_width){
max_width++;
crrnt_width = 0;
printf("\n");
}

}

return 0;
}