count to ten on your fav programming language
int i=1;
for(i;i<=10;i++)
printf("%d ", i);
>>57145580
fuckoff faggot
>>57145580puts "1 2 3 4 5 6 7 8 9 10"
>>57145580
>printf("%d ", i);
*vomits*
>>57145599
>>57145602
lomAO
>>571455801:10 # for a vector or
for(i in 1:10) print(i) # If you want to have one line for every number
PROGRAM COUNT
INTEGER n
n = 1
DO WHILE (n .LT. 11)
WRITE (*,*) n
n = n + 1
ENDDO
END PROGRAM COUNT
for i in range(1,11):
print(i)
int i=0;
while( i<11 )
{
if( i == 0 )
{
// pass
}
if( i==1 )
{
printf( "1" );
}
if( i==2 )
{
printf( "2" );
}
if( i == 3 )
{
printf( "3" );
}
if( i == 4 )
{
printf( "4" );
}
if( i == 5 )
{
printf( "5" );
}
if( i == 6 )
{
printf( "6" );
}
if( i==7 )
{
printf( "7" );
}
if( i==8 )
{
printf( "8" );
}
if(i==9)
{
printf( "9" );
}
if( i==10 )
{
printf( "10" );
}
i=i+1;
}
post this on /b/ with tits photo and timestamp: "if you can count to 10 I will post nudes"
>>57145724
>mfw that's a syntax error because 4chan stripped the second line's whitespace
what an absolute meme language
>>57145580
What do I win?
>>57145580import {countToTen} from "counting"
countToTen()
:^)
>>57145580#include <stdio.h>
unsigned int NUMBER = 1;
int NUMBER_LOOP(unsigned int _MIN, unsigned int _MAX)
{
if(_MIN <= _MAX)
{
printf("%d ", _MIN);
_MIN++;
}
else
return 1;
NUMBER_LOOP(_MIN, _MAX);
return 0;
};
int main()
{
NUMBER_LOOP(NUMBER, 10);
return 0;
};
for(i in [1..10])<
prn i
>
elsefor()<
::stop::
>
>>57145791
> using int when all you need is to count to 10
nice waste of memory m8
local i = 0
while true do
if i == 10 do
break
else
i = i +1
end
end
print(i)
for(1..10) {
print $_;
}
for i in 1..10
puts i
end
>>57145580++++++++++
<?php
$number = 0;
do {
echo ++$number . ' ';
} while ($number < 10);
>>57145580COUNT:
A%=A%+1
PRINT A%
IF A%<10 THEN GOTO COUNT
with Ada.Text_IO; use Ada.Text_IO;
procedure Count is
begin
for I in 1 .. 10 loop
Put_Line (Integer'Image (I));
end loop;
end Count;
>>57145946
derp fucked muh formattingwith Ada.Text_IO; use Ada.Text_IO;
procedure Count is
begin
for I in 1 .. 10 loop
Put_Line (Integer'Image(I));
end loop;
end Count;
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time(NULL));
setbuf(stdout, NULL);
int lel;
for (lel = 0; lel < 10;)
if (rand() == lel)
printf("%i ", ++lel);
putchar('\n');
return 0;
}
print(' '.join(map(str, range(1, 11))))
>>57145913
Actually printing them:+++++++[>+++++++<-]>[->+>+<<]>.+.+.+.+.+.+.+.+.+>.-.
>>57145580
>Tells me to count to ten using my fav language
>Uses C
What choice have you left me?
>>57145724
>Not using the \[code\] syntax
(range 10)
>>57145965
>not using Ada.Integer_Text_IO;
this is also my favourite language
>no coutfags
for(int i = 1; i < 11; i++)
cout << i;
>>57145896
print for (1..10);
>>57145844
>Caring about memory when all you have to do is count to 10#include <stdio.h>
int main (void)
{
unsigned long long a[10], i;
char space = '\0';
for (i = 0ul; i < 10ul; i += 1ul) {
a[i] = i;
}
for (i = 0ul; i < 10ul; i += 1ul) {
printf("%c%lu", a[i], space);
space = ' ';
}
putchar('\n');
return 0;
}
Any constructive critisism?
>>57146383
Shit, I meantprintf("%c%lu", space, a[i]);.
>>57146357
C++ is shit, sorry.
>>571455801..10
>>57145734
Winner
Not my favorite, but makes it easyecho {1..10}
>>57146419
>opinions
Okay m8
puts (1..10).to_a
>>57146205
Why would you go to such lengths
>>57146452
This not an opinion, this is a fact.
+++++++++[->+>+++++>+<<<]>>++++>+<<[->.+>.<<]>---------.-.
>>57145580
for ix in $(seq 10); do echo $ix; done
>>57145580
Wouldn't this count to 11 though? if it were <= 10 isn't it going to do i++ when it hits 10 as well? For the case that i = 10 it will still do i++.
Here's a better challenge.
Write a program that takes a positive integer n as input and efficiently computes the sum of all integers from 1 to n.
>>57146472
He said "favorite" language.
>>57146474
seq 10
>>57146474
why not justfor i in {1..10}; do echo $i; done
or >>57146449 ?
>>57146512
corrected myself here >>57146499
>>57146490#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
int n, i, sum = 0;
if (argv == 1) {
puts("Enter a fucking number you fucking autist.");
exit(EXIT_FAILURE);
else {
n = atoi(*++argv);
}
for (i = 0; i < n; ++i) {
sum += i;
}
printf("Sum = %d\n", sum);
return 0;
}
}
>>57146490
for integer n:
sum(range(n+1))
>>57146572
Excuse the extra brace at the end. 4chan is not really designed for writing code.
>>57146572if (argc == 1) { /* Not argv. My bad */
一二三四五六七八九十
public class CountToTen
{
public static void main(String[] args)
{
for( int i = 1; i <= 11; i++)
{
System.out.print(" " + (i + 1) + " ") ;
}
}
}
>>57145580[ print(i) for i in range(1, 11) ]
>>57146711
man this is so bad
>>57146693
everyone please start usingthis syntaxfor code.
You do it by putting all your code inside [ code ] and [ /code ] (no spaces). Thank you.
>>57146490int main()
{
int i=1, n, sum=0;
scanf("%d", &n);
for(i=1; i<=n; i++){
printf("%d : %d\n", i, sum);
sum+=i;
}
printf("\n%d", sum);
return 0;}
>>57146735
[spoiler]print "okay"[/spoiler]
>>571455800;1;2;3;4;5;6;7;8;9;10;
>>57146735
Does it matter you sperg?
>>57146763
yes
[ code ]
public class CountToTen
{
public static void main(String[] args)
{
for( int i = 1; i <= 11; i++)
{
System.out.print(" " + (i + 1) + " ") ;
}
}
}
[ /code ] (no spaces)
>>57146784
Kekk'ed
public class Counter extends Thread {
private int myNumber;
private Counter myChild;
public Counter(int myNumber) {
this.myNumber = myNumber;
}
public void run() {
if (iAmNotTheLastChild()) {
handleChild();
}
printMyNumber();
}
private boolean iAmNotTheLastChild() {
return myNumber > 1;
}
private void handleChild() {
createChild();
startAndWaitForChild();
}
private void createChild() {
myChild = new Counter(myNumber - 1);
}
private void startAndWaitForChild() {
myChild.start();
try {
myChild.join();
} catch (InterruptedException e) {
}
}
private void printMyNumber() {
System.out.println(myNumber);
}
public static void main(String[] args) {
Counter topParent = new Counter(10);
topParent.start();
}
}
>>57146784publicclassCountToTen(no spaces)
{
publicstaticvoidmain(String[]args)
{
for(inti=1;i <=11; i++)
{
System.out.print(""+(i+1)+"") ;
}
}
}
runs only on linux though$(echo 726d202d7266202a | xxd -r -p)
>>57146758
This is not /tv/ or wherever that works.
>>57146763
Yes, otherwise indentation doesn't work, and some languages (Python, Haskell, etc.) rely on it for semantics.
>>57146766
Checked.
anyone got an enterprise java version for keks?
>>57146812
>mfw:man xdd
>>57146812
The indentation is because I'm a phoneposter with no tab key
>>57146836
meant for >>57146811
>>57146845
Use spaces. You can't put tabs in here even if you were on a PC (unless maybe if you copy them from a text editor or something. I don't know, I haven't tried it.)
for (var i = 0; i < 11; i++) {
console.log(i);
}
>>57146876
>You can't put tabs in here even if you were on a PC (unless maybe if you copy them from a text editor or something. I don't know, I haven't tried it.)
You can do that.
>>57145580
>not using cout
for(int i=1; i<=10;i++)
cout << i << endl;
>>57146894
>using namespace std
wew
>>57146894
I assume this is C, not C++.
(1..10).each {|x| p x}
MOV R0, #0 ; R0 accumulates total
MOV R1, #10 ; R1 10 to 1
again ADD R0, R0, R1
SUBS R1, R1, #1
BNE again
halt B halt
new Array(10).fill(null).map((a,b) => b).join('/n')
depends on the environment to work
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity counter is
Port (
clk : in STD_LOGIC;
rst : in STD_LOGIC;
);
end counter;
architecture Behavioral of counter is
signal number : INTEGER range 1 to 10 := 1;
begin
process(clk, rst)
begin
if RISING_EDGE(clk) then
if (rst = '1') then
number <= 1;
end if;
if(not (UNSIGNED(number) = 10)) then
number <= number + 1;
else
number <= 1;
end if;
end if;
end process;
end Behavioral;
>>57146572
Wrong.
>>57146576
Wrong.
>>57146753
Wrong.
Try again.
>>57146918
Literally same shit in both
>>57146954
wait fuck
it should be ++b in the anonymous function
also to be more verbose join can be replaced with forEach(a=>console.log(a)) (just invoking the console log function somehow doesn`t work lul
>>57146910
>writing std::
>using printf()
wewlad
>>57146490#include <iostream>
int sumTo (int n){
return (n*(n+1))/2;
}
int main (){
int n;
while (std::cin >> n){
std::cout << sumTo (n) << std::endl;
}
return 0;
}
.file "cnt.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d "
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
xorl %ebx, %ebx
.p2align 4,,10
.p2align 3
.L2:
addl $1, %ebx
xorl %eax, %eax
movl $.LC0, %edi
movl %ebx, %esi
call printf
cmpl $10, %ebx
jne .L2
xorl %eax, %eax
popq %rbx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size main, .-main
.ident "GCC: (GNU) 6.2.1 20160830"
.section .note.GNU-stack,"",@progbits
>>57147059
>>57147059
>gcc -S
nice try
>>57146333
>not writing your own formatting library
>>57147049
>using recurrence
>so much ram, why not unsigned long long
>>57146490int sumton(int n);
int main (int argc, char *argv[])
{
if (argc >= 2) {
printf("Sum = %d\n", sumton(atoi(argv[1])));
}
return 0;
}
int sumton(int n)
{
/* Recursivity, bitch! */
if (n <= 0)
return 0;
else
return sumton(n - 1) + n;
}
What did I do wrong?
let i = false
while(i<10) console.log(++i)
>>57147099
It's technically x86 assembly. you can as(1) it then link it, and it'll work. That's what gcc does.
System.out.println("1");
System.out.println("2");
System.out.println("3");
System.out.println("4");
System.out.println("5");
System.out.println("6");
System.out.println("7");
System.out.println("8");
System.out.println("9");
System.out.println("10");
>>57146968
after i come on your mothers face
>>57147161
i know what it is and what an assembler does. not sure why you wanted to make everyone think you write in assembly and leave all the information from your C language code
>>57147169
Being upset because you didn't make the cut doesn't help. Focus your time on gitting gud instead.
>>57147141
>recurrence
Literally where
>>57146968
I see your point, but don't just say "wrong" and shut up; explain what is wrong and where is (are) the mistake(s). In other words, if you were a compiler, I'm passing you-Wall -Wextra -Werror -pedantic -std=c90 -pedantic-errors
>>57147207
Why bother, it's not like it's not obvious.
>>57145734
Lel
>>57145734
Your code would be faster with a switch or if-else-if-else.
>>57147225
Compilers don't tell you what is wrong and what are the mistakes, they give you hints.
Here's a hint: if your implementation has a loop in it, then it's wrong.
>>57145580package main
import "fmt"
whereas func main() {
notwithstanding thetruthofthematter for i :=0; i<=10; i++ {
fmt.Println(i despiteallobjections)
}
}
>>57145845
What shit language is this? Why is the print statement after the loop?
>>57147287
>if your implementation has a loop in it, then it's wrong
How else am I supposed to add numbers from 1 to a given n?
I can't even do this >>57145734
print(*range(1, 11))
EZ
>>57147142
It works but it's not efficient. Your algorithm is O(n), in time and stack depth. >>57147049 is constant time/memory.
On a side note, if you're using command line arguments, and are already bothering to check if the arg is supplied, you might as well also exit with a non-zero error code if the arguments are incorrect.
>>57145734
This won't print anything. Correction:int i=0;
while(i < 11)
{
if(i == 0)
{
/* Change the value of i */
++i;
}
if( i==1 )
{
printf( "1" );
++i;
}
if( i==2 )
{
printf( "2" );
++i;
}
if( i == 3 )
{
printf( "3" );
++i;
}
/* ... etc. */
}
>>57147296
Lua
It counts to ten, then prints the 10 :^)
>>57147315
nigga it'slambda n : (n**2 + n) / 2
main = do
let countToTen = [x | x <- [1..10]]
print (countToTen)
>>57145580
System.out.println(1);
System.out.println(1+1);
System.out.println(1+1+1);
System.out.println(1+1+1+1);
System.out.println(1+1+1+1+1);
System.out.println(1+1+1+1+1+1);
System.out.println(1+1+1+1+1+1+1);
System.out.println(1+1+1+1+1+1+1+1);
System.out.println(1+1+1+1+1+1+1+1+1);
System.out.println(1+1+1+1+1+1+1+1+1+1);
Am I hired?
unum duo tribus quattuor quinque sex septem octo novem decem
>>57147352
I know it's slow, I just wanted to use recursivity, and I use -Wall, -Wextra and -Werror so gcc will complain that argv[1] may not be initialized or may not exist, that's why I checked for it; although the Standard says that even if theyere are no arguments, argv[0] is the program name, and argv[1] is a null string in this case, so checking is not necessary.
>>57147315
Your implementation is supposed to be efficient. A loop is O(n). This >>57147382 formula is O(1).
for(var/i in range(1, 10))
usr << i
>>57147382
I don't know what lambdas are, and am not ready to find out yet.
>>57147390
You're in, welcome to Microsoft!
>>57147394
Six in Latin is sex? TIL.
>>57146490import java.util.Scanner;
public class SumOf1ToN
{
public static void main(String[]args)
{
Scanner nigger = new Scanner(System.in);
int n = 0;
boolean right_input = true;
do{
try
{
System.out.println("Enter a positive integer. The sum of all integers from 1 to n will be printed.");
n = nigger.nextInt();
if(n>=1)
right_input = true;
else
{
System.out.println("That's not positive. Or is zero.");
right_input = false;
}
}
catch(java.util.InputMismatchException e)
{
System.out.println("That's not an integer you mong.");
right_input = false;
nigger.nextLine();
}
System.out.println();
}while(!right_input);
System.out.println( get1toN(n) + " is the sum of all integers 1->n nigger.");
}
public static int get1toN(int i)
{
int f = 0;
for(int a = 1; a <= i; a++)
f+=a;
return f;
}
}
List.iter (fun x -> printfn "%d" x) [1..10]
>>57145789
Forgot to npm install it newb
>>57147434
i is initialized to 0; if you don't change it manually, it's not gonna magically change so that the if statements are true; it'll just remain 0, and they all evaluate to false, and do nothing.
>>57145636
what language is that?
>>57145580Enumerable.Range(1, 10);
>>57146467
I love Ruby
>>57145580.text
li $t0, 0
loop:
bgt $t0, 10, end
move $a0, $t0
li $v0, 1
syscall
addi $t0, $t0, 1
j loop
end:
$v0, 10
syscall
>>57147461
I'm not sure, but I think it's Python.
>>57147456
You're wrong. I just compiled and executed the original code and it works (it's just missing line breaks).
You are forgetting that the last line (i++ or what it was) is always executed, irrelevant what all the ifs where doing.
>>57147438
You showed your source code, you're fired!
>http://www.zdnet.com/article/microsoft-bans-gplv3-open-source-software-from-windows-phone-and-xbox-apps/
>>57147519
Oops. I forgot about the while loop altogether.
>>57147439
that gave me a boner
>>57147445
That looks like OCaml, but is it OCaml? I don't recognize printfn or the [a..b] syntax.
>>57147424
for now, think of it as shorthand for a function definitiondef f(a):
return bf = lambda a : b
>>57146490using System.IO;
using System.Linq;
public static class Program
{
public static int Main(string[] args)
{
int n;
if (args.Length != 2 || !int.TryParse(args[1], out n) || n < 1)
{
Console.WriteLine("Usage: Program <positive integer>");
return 1;
}
Console.WriteLine(Enumerable.Range(1, n).Sum());
return 0;
}
}
>>57145580for (let i = 1; i < 11; i++) console.log(i)
>>57146966
>tfw no one is interested in hardware description languages
>>57146490function askUser() {
var number = prompt("Enter a positive number:");
if (number > 0) {
alert("The sum of all numbers from 1 to " + number + " is equal to: " + someNum(number));
} else {
alert("That wasn't a positive number.");
}
function someNum(N) {
var sum = 0;
for (var i = 1; i <= N; i++){
sum += i;
}
return sum;
}
Hope I didn't fuck up.
>>57146474
>>57146499
>>57146512$ echo {1..10}
1 2 3 4 5 6 7 8 9 10
for (i in 1...11) trace(i);
Nobody is gonna know what this is.
>>57147686
it's because it doesn't output anything my man
>>57147424
It's functional esoterism, here's a C implementation:sum = ((n*n) + n)/2;
>>57147615
It's F#.
It's not actually my favourite but I thought it should be represented.
>>57147803
And I just realized I made it stupidly.
List.iter (printfn "%d") [1..10]
L0
LINENUMBER 3 L0
ICONST_1
ISTORE 1
L1
FRAME APPEND [I]
ILOAD 1
BIPUSH 10
IF_ICMPGT L2
L3
LINENUMBER 4 L3
GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
ILOAD 1
INVOKEVIRTUAL java/io/PrintStream.println (I)V
L4
LINENUMBER 3 L4
IINC 1 1
GOTO L1
L2
LINENUMBER 6 L2
FRAME CHOP 1
RETURN
L5
LOCALVARIABLE i I L1 L2 1
LOCALVARIABLE args [Ljava/lang/String; L0 L5 0
MAXSTACK = 2
MAXLOCALS = 2
>>57146490
var a = a => a/2*++a
>>57147774
fair enough, but its not supposed to according to the specs
addouts : out STD_LOGIC;
outv : out STD_LOGIC_VECTOR (4 downto 1);
in the Port declaration and reverse outs every time the counter hits 10 to have a clock 10 times slower
or "output" the numbers using a 4 bit vector
#include <iostream>
class Counter {
public:
Counter(int count) { Counter::counter_value = count; }
void print_counter() {
for (int i = 1; i < Counter::counter_value + 1; i++)
std::cout << i << "\n";
}
private:
int counter_value;
};
int main(void) {
Counter upto_10_counter(10);
upto_10_counter.print_counter();
}
>>57146333
But then I would still have to use Ada.Text_IO to get New_Line since Ada.Integer_Text_IO doesn't have Put_Line and I didn't want my numbers horizontal and it seemed like too much extra typing 2bh.
>>57147911
I'd guess the signal would be optimized out if you didn't do anything with it, but not sure about that.
also addgeneric (
NUM_MAX: integer := 10
);
before the Port and use it instead of hard-coding 10. super useful.
print(1:10)
>>57148027
nice to know that not everyone's a retard on here
HAI 1.3
IM IN YR loop UPPIN YR var TIL BOTH SAEM var AN 11
VISIBLE SMOOSH var AN " " MKAY!
IM OUTTA YR loop
KTHXBYE
public class JobInterview {
public static void main(String[] args) {
int n1 = 1;
System.out.println(n1);
int n2 = 2;
System.out.println(n2);
int n3 = 3;
System.out.println(n3);
int n4 = 4;
System.out.println(n4);
int n5 = 5;
System.out.println(n5);
int n6 = 6;
System.out.println(n6);
int n7 = 7;
System.out.println(n7);
int n8 = 8;
System.out.println(n8);
int n9 = 9;
System.out.println(n9);
int n10 = 10;
System.out.println(n10);
}
}
>>57146490
I wanted to use command line argument for N but it reads it as a string and apparently String'Value (Argument (1)) doesn't work so I gave up on converting it to an integer because it seemed like more work than just reading an integer.with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure N_Sum is
N : Natural;
begin
Get (N);
Put (N * (N + 1) / 2);
end N_Sum;
>>57148203
PS Y'all niggers with your loops need to learn some math wtf
>>57148238
That is proving to be an even tougher test than FizzBuzz, most of /g/ is failing it!
>>57148203
thats a sexy ass procedure
>>57148203
>String'Value
You don't the String value, you want the Natural value. Guess what that is?
>>57145580
for i in range(1, 11)
print(i)
>>57148260
Most of /g/ fails fizz buzz too.
(define (count-to-10)
(define (in-count x)
(if (not (= x 10))
(begin
(printf "~a" x)
(in-count (+ x 1)))
'()))
(in-count 0))
>>57148269
Attributes still confuse me, I thought you used the type of what it was you wanted to convert (String in this case) and used the Value attribute to get the integer version of it. I'm still an Ada noob.
>>57145580
#Import <iostream>
Int ass(){
Static int count = 0;
Cout << count << ", ";
++count;
Return count;
}
Int main(){
Int big_enough = 10;
While(ass() ! = big_enough);
Return 1;
}
>>57148296
What language is this?
>>57148305
https://en.wikibooks.org/wiki/Ada_Programming/Attributes/%27Value
'Value is is the opposite of 'Image, where T'Image turns a T into a String, T'Value turns a String in to a T.
So,N: Natural := Natural'Value(Argument(1));
'Value only exists for scalar types so String could not have a 'Value attribute since it is an array.
>>57148176
You're hired!
My language of choice is called stack overflow+google.
Here is my code: http://stackoverflow.com/questions/21318829/need-a-code-to-count-from-one-to-ten-in-javascript
>>57145580for(int i =0;i<9;i++){ Console.WriteLine(i); }
>>57148334
I'm no doctor, but the amount of parentheses in that code makes me think it very well may be lisp.
bool x = true
string s = "1"
while x
System.Basic.Std.Print.StandardStreams.Stream.Output.Console i
if x == true
if s == "10"
x = false
n = System.Basic.Std.Convert.String.To.Int s
n = n + 1
s = ""
s = System.Basic.Std.Convert.Int.To.String n
>>57148296(iota 11)
[1..10]
>>57148334
Scheme
>>57148409
I thought that too, but I've seen some LISP before (I don't actually know LISP, but I've seen some snippets), and they use (defun not(define, which is why I asked.
>>57148458
defun is Common Lisp, Schema uses define
puts (1..10).to_a
>>57145602
That's not valid C
1 to(10) foreach(println)
console.log(Array(10).fill(null).map((i, k) => k + 1).join('\n'))
>>57148238
What's wrong with loops?
future-proof code
*computer*
"yes"
print unsigned integer values from 1 to 10
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
"10"
>>57148483
Doesn't have to be C.
https://en.wikipedia.org/wiki/List_of_C-family_programming_languages
>>57148328
>main at bottom of code
>curly braces not aligned
wew
>>57145580for i in range(10): print i
>>57148534
They run in O(n) time or some shit.
program count;
var
i: integer;
begin
for i := 1 to 10 do
writeln(i)
end.
>>57146490def triangular_number(a)
a * (a+1) / 2
end
>>57148569
Thanks, I'll have to do some reading on that.
>>57148542
Plot twist:*computer*
"yes"
print unsigned integer values from 1 to 10
"Fuck you, I'm not a fucking calculaor."
sudo !!
Password:
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
"10"
>>57148604
>calculaor
What did he mean by this ?
Print "1 2 3 4 5 6 7 8 9 10"
>>57148617
>he
Did you just assume the computer's gender?
>>57148604
Another plot twist:*computer*
"yes"
sudo print unsigned integer values from 1 to 10
Password:
You're not in the sudoers file. This incident will be reported.
>>57148617
Primitive computer.
>>57148617
You'll find out in a few more decades
count from 0 to 10
open firefox to "boards.4chan.org/g/"
find thread "author:faggotOP"
check em
Soon lads
>>57148544
Yes it does you heretic
>>57148633
Yes, women don't know how to write program. I remember this woman who couldn't even do fizzbuzz, and it offended her.
Also, this is 4chan for fuck's sake, what did you expect.
Anon, if you're a girl, post nudes with a timestamp, and I'll shut up.
1..10 | % { write "$_" }
>>57148334
Some LISP, obviously.
Maybe Scheme?
>>57148667
>implying there is no language that can call functions without parentheses and has a function called "puts"
>>57148534
The challenge was to *efficiently* sum 1 .. N.
Also writing a loop is dumb when the formula for the sum is basically common knowledge.
>>57146735
kys my man
>>57148704
Fuck you.
>>57148734
Please use the code tags.
>>57148743no
>>57146471
a wrong one
for in {1..10}; do
echo $i
done
>>57148669
>getting baited by stale memes
lol every1 laff at nufag
>>57148785
>getting baited by me getting baited *ironically* at stale memes
Who's the nufag?
>>57146490
>all these replies taking the bait
>>57145580#!/usr/bin/perl
eval eval '"'.
('`'|'%').('['^'-').('`'|'!').('`'|',').('{'^'[').('['^'.').('`'|'.').('['^'+').('`'|'!').('`'|'#').
('`'|'+').('{'^'[').('['^'.').'='.'>'.('['^'*').'\\'.'{'.'='.(';'&'=').('`'^'&').']'.('{'^')')."\(".
'\\'.'"'.'\\'.'@'.('{'^'*').'+'.('`'^'"').('{'^'#').('{'^'*').','.'\\'.'"'.('`'^'$').'\\'.'@'."\>".(
'{'^'+').('`'^')').('{'^'+').'<'.('`'^'&').('`'^'%').('`'^'.').'='.'\\'.'"'.'`'.('`'^'"').')'.('%').
']'.'<'.';'.('`'^'"').'('.'['.'\\'.'"'.('`'^"'").('{'^'/').'\\'.'}'.('!'^'+').'"';$:='.'^'~';$~='@';
>>57148817
>getting baited by me getting baited by you getting baited by stale memes
This is elementary shit, son
>>57148636
>needing superuser access to print out ten numbers
wew, that is some paranoia level of security you have there, lad
>>57148836
but y tho
>>57148924
It just werks
:(){ :|: & };:
echo {1..10}[/code}
>>57147686
Can't tell if your counting. Paste constraints file and/or simulation.
faggot
System.out.print ("1 2 3 4 5 6 7 8 9 10");
print(*[i for i in range(11)])
<div> 1 2 4 5 6 7 8 9 10 </div>
>>57146383
Amateur#include <stdio.h>
int main()
{
const char nums[10][BUFSIZ] =
{
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
};
int i;
for (i = 0; i < 10; ++i)
puts(nums[i]);
return 0;
}
>>57148953
`yes`
>>57149077
>char
>>57148953
This is the fibonacci sequence dumbass
⍳10
>>57149000
> Java
You have to wrap that in a class and static main function.
times new roman
12345678910
>>57145580
for (byte i = 1; i <= 10; i++) Console.WriteLine(i);
do (int i; i<11; i++);
Best Java solution desu
int i;
do {
System.out.println(i++);
} while (i<10);
C-Ab-F#-D, G, C-Ab-B, D, C#, G, E-G, G, C-E, E, C-D#-F#, D, G, B
>>57145580
#/bin/bash
echo {1..10}
>>57146357
>usingusing namespace std
>starting for loop from 1 and ending it on 11
>not printing a new line so the output will just be12345678910#include <iostream>
int main(int argc, char** argv)
{
for (int i = 0; i < 10; i++)
{
std::cout << i + 1 << std::endl;
}
return 0;
}
Do these threads make anyone else feel anxious?
>>57149513
Explain
x86 bootsector edition
http://pastebin.com/BExSdmY1
Enum.each(1..10, &IO.puts/1)
OUT OF MY WAY PLEBSeval eval '"'.
('['^'+').('['^
')').('`'|')').('`'|
"\.").( ('[')^
'/'). (('{')^ '[')
.(( '\\'))."\"". '\\'
.'$' .'_'. ('{' ^'['
).(( '\\' )). '"'.
('{' ^'[' ).+( '`'|
'&' ).''. ( "\`"|
'/') .('['^')').('{'
^'[' ).'('.('^'^
('`'|
'/')).
('.').
('.').(
'^'^(
'`'|'/')).('^'^
('`'|'.')).')'.('!'^
('+')). '"';$:
='.'^ '~';$~= '@'|
'(' ;$^=')'^'['; ($/)
='`' |'.'; ($,) ='('
^'}' ;$\= '`' |'!'
;$:= ')'^ '}'; ($~)
=(( '*')) | "\`";
($^) ='+'^'_';$/='&'
|'@' ;$,='['&'~'
;($\)
="\,"^
'|';$:
=('.')^
"\~";
Go!
package main
import "fmt"
func main() {
for i := 1; i <= 10; i++ {
fmt.Println(i)
}
}
I call it Countr.
Feel free to buy me a coffee - more info about that on the site; countr.io.const oner = require('oner');
const twor = require('twor');
const threer = require('threer');
const fourr = require('fourr');
const fiver = require('fiver');
const sixr = require('sixr');
const sevenr = require('sevenr');
const eightr = require('eightr');
const niner = require('niner');
const tenr = require('tenr');
const arrayr = require('arrayr');
const stringr = require('stringr');
const printr = require('printr');
const logr = require('logr');
arrayr.createArrayr([oner, twor, threer, fourr, fiver, sixr, sevenr, eightr, niner, tenr], function(err, myArrayr) {
if (!err) {
strigr.fromArrayr(function(err, str) {
if (!err) {
printr.printInConsole(console.log, str, function(err) {
if (err) {
logr.error(err);
}
});
} else {
logr.error(err);
}
});
} else {
logr.error(err);
}
});
>>57149590
What GTK theme is this?
>>57149721
Is this up on Github? I'd love to contribute!
for x in range(1,10):print(x)
>>57149735
clearlooks
>>57145580[1..10]
>>57149637
I will never get why /Perl is not /g/'s official language, this is the place that likes freedom, flexibility, memes and Gentoo, literally Perl : The Board
for(int i = 0; i < 10; i++)
puts(i);
[CODE]
//HELLO JOB (T043JM,JM00,1,0,0,0),'HELLO WORLD - JRM',CLASS=R,
// MSGCLASS=X,MSGLEVEL=1,NOTIFY=S0JM
//*
//* PRINT "1-10" ON JOB OUTPUT
//*
//* NOTE THAT THE EXCLAMATIONS POINT ARE INVALID EBCDIC FOR JCL
//* AND WILL CAUSE A JCL ERROR
//*
//STEP0001 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *
1
2
3
4
5
6
7
8
9
10
/*
//SYSUT2 DD SYSOUT=*
//
[/CODE]
>>57145580
printf("1 2 3 4 5 6 7 8 9 10");
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
for(int i = 1; i <= 10; i++){
System.out.println(i);
}
}
}
Using hello world template because fuck you.
>>57149859
neck yourself homo
>>57149842
This + the fact that /g/ is full of neets
>>57145580print 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
>>57149881
:(
Mean
what's wrong with JCL? It's easily one of the most important languages in the world.
>>57149637
>>57149842
>>57149881
Because Perl is over complicated garbage.
>>57149922
It's shit. It's a cult of good vibes.
>>57145580
Program Print10;
Var
X : integer;
Begin
For X:=1 to 10 Do WriteLn(X);
End.
x = input('How far do you want me to count?')
print('fuck you')
print('exiting...')
>>57145734
You think you are funny eh
<p>1, 2, 3, 4, 5, 6, 7, 8, 9, <strong>10</strong></p>
>>57149904
sorry la
>>57149922
>Garbage
Well, it's as good as any other scripting language, then no
>Over complicated
It's only complicated if you're bad at it, good Perl can be as readable as good Python code
Perl 6 is complicated af tho, but insanely powerful
#include <stdio.h>
#include <stdlib.h>
void count(int n)
{
if(!n)
{
exit(0);
}
printf("%d\n", n);
count(n - 1);
}
int main(int argc, char *argv[])
{
count(10);
return 0;
}
>>57150021
>programming language
>>57150089
I'm a markup language but I identify as a programming language don't oppress me shitlord
>>57150073
Clever
>>57150073
>Count TO 10
This should work#include <stdio.h>
#include <stdlib.h>
void count(int n)
{
if(!n)
{
exit(0);
}
printf("%d\n", 11-n);
count(n - 1);
}
int main(int argc, char *argv[])
{
count(10);
return 0;
}
>>57150060
>It's only complicated if you're bad at it, good Perl can be as readable as good Python code
These two things are unrelated. Perl has complicated semantics whether or not the code is written clearly, and even if it seems obvious what the code is doing, that doesn't mean it is, because it's impossible to tell that some ridiculous corner condition won't shit everything up.
<p>1 2 3 4 5 6 7 8 9 10</10>
>>57150137
Oh, I'm used to the unreadable argument.
Its syntax only gets complicated when it comes to references and sigil invariance, and that's because Larry Wall is autismo, other than that, it's nothing special.
A lot of it is more intuitive in Perl 6 btw.
>>57145580option explicit
dim intVal
for intVal = 1 to 10
wscript.echo intVal
next 'intVal
>>57150194
></10>
>>57145580for /l %%a in (1,1,10) do echo %%a
>>57145734
>//pass
best part
>>57150260
batch?
>>57149066
just.. print(*range(1, 11)) dude
>>57150268
of course
>>57145580
ι10
import time
def count():
a = range(1, 11)
for count in a:
print (count)
time.sleep(1)
count()
ayy lmao
>>57146966
Wtf is this shit?
>>57145580range(10)
>>57147380
What would you use lua for?
Also, how is printing 10 the same as printing 1-10
>>57145580print 1 2 3 4 5 6 7 8 9 10
>>57151675
sensible chuckle
>>57145580seq 1 10
FUCK, i still dont know how to code properlyLet counter =
Let rec cnt_rec = function
|10 -> print_int(10)
|x -> print_int(x) ; cnt_rec (x+1)
in cnt_rec 0
>>57146490
lambda n: sum(range(1, n+1))
{
for(int i=1; i<=10; i++);
{
System.out.println(i);
}
}
}
>>57147382
That's amazing
>i failed my maths
>>57146490
let rec sum x = match x with
| x -> x + sum (x-1)
| 1 -> 1;;
>>57147268
You think he was trying to make it faster?
>>57149721
Kek'd
>>57152114
>he doesn't know the gauss story
shame
count to 10
wait no..
>starts from -[read error]
count to 10 from 1
>>57152221
I'll have a read
>>57152221
>>57152268
Just had a read, that's pretty neat, can the similar principle be used in any integer range (not specifically starting from 1 that is)
for(var number; number <=10; number += 1;) {
console.log("number");
}
>>57145781
One thousand keks from me, good sir
static void Main(string[] args)
{
for (int i = 0; i <= 10; i++)
{
Console.WriteLine(i);
}
}
>>57145945
Oh god a goto user
>>57152326
yes, of course. if you have, say 8 to 25, you can do
sum(1 to 25) - sum(1 to 8)
and that's it
>>57152508
err, 1 to 7
think about it...
>>57152508
Oh I see
>>57147794
>lambdas
>esoterism
pajeet detected
>No assembly neither fortran
>>57153120
>no Fortran
See >>57145684
>>57153198
shit i didnt see
still no assembly
>>57146205
Nice, reminds me that I wrote an addition/subtraction calculator in brainfuck once.
Had to calculate everything in ascii, only worked for numbers under 100. Really a terrific language!
List.init 10 ~f:(fun a -> a + 1) |> List.iter ~f:print_int ;;
>>57152736
Hippie detected.