QUICK!
WRITE A PROGRAM IN YOUR FAVORITE LANGUAGE THAT ASKS THE USERS NAME
AND AGE AND DISPLAYS THE LENGTH OF THEIR NAME AND THEIR AGE + 1
OR THIS BIRD WITH A KNIFE IS GOING TO STAB YOU!
public static void main(String... args) {
System.out.println("what are you gonna do, stab me?");
}
>>56363609
plz dont hurt me#!/usr/bin/perl -w
# script to avoid knife wounds
use strict;
print "Enter a name: ";
my $name = <>;
print "Enter an age: ";
my $age = <>;
$age++;
my $lenName = length $name;
print "Length of name: $lenName\nAge + 1: $age";
>>56363609
name = input("what do people call you?:")
age = input("for how many years have you been suffering on this ungodly earth?":)
print("your age + 1 is %s your name + 1 is %s + 1" % (float(age) + 1, name))
>>56363609
<!DOCTYPE html>
<html>
<head>
<title> stab me </title>
<body>
<p style="font-family: Times New Roman"> stab me </p>
</body>
</head>
</html
#!/bin/bash
echo what is name
read name
echo what is age
read age
echo name length ${#name} and age + 1 $((age + 1))
>>56363954
>html
come on OP this is like chapter 1 homework
if you start like this now you're never gonna make it
>QUICK DO MY HOMEWORK FOR ME IT'S DUE IN AN HOUR
Do your own work, kid. If you can't do something so fucking simple you deserve to fail your class.
>QUICK DO MY HOMEWORK GEE
>PLS
>GIMME ATTENTION
>PLS
>MY WIFE'S SON HATES ME
>>56363609
Thats a pretty boring one OP
Sometimes these are an interesting challenge
>>56363609puts "a/s/l ?"
a,s,l = gets.chomp.split
a = a.to_i
puts a < 12 ? "oh fugg!" : a < 16 ? "wanna cs?" : "meh, too old"
>going on 4chan for homework answers instead of just googling it.
>"how to user input integer"
>"how to add 1 to an integer"
>"how to convert int to string"
>>56363609
function fuckOffBird(){
var name = prompt('Name?');
var age = prompt('Age?');
alert(name.length + parseInt(age) + 1);
}
>>5636360910 PRINT "WHAT IS YOUR NAME?"
20 PRINT "THE LENGTH OF THEIR NAME AND THEIR AGE + 1"
30 END
print "just fuck my boipussy up senpai"
>>56364867
>5 lines of code
>And people still hate JavaScript
Can anyone beat 5 lines?
>>56365007
var name = prompt('Name?');
var age = prompt('Age?');
alert(name.length + parseInt(age) + 1);
>It actually could be 3 lines
>>56365038
var name = prompt('Name?'), age = prompt('Age?');alert(name.length + parseInt(age) + 1);
1 line
>>56365117
I want to say that doesn't really count. But it's probably because I'm salty.
RATE:#!/bin/bash
age=0
agegood=0
ageask() {
echo -n "age plz in number retart: "
read age
if [ "$age" -eq "$age" ] 2>/dev/null; then
agegood=1
else
echo omg you retardo
fi
}
echo -n "name plz: "
read name
while [ $agegood -eq 0 ]; do
ageask
done
echo -n "lenth of ur name is "
echo `expr length $name`
echo -n "ur age + 1 is "
echo `expr $age + 1`
>>56365463
>backtickss
what the fuck are you even doing here
http://i.imgur.com/QRKfEc6.gif
>>56365749
I like backticks, and what are you doing here when u don't even post images to an imageboard?
print(str(len(raw_input("What's your name?: "))) + "\n" + str(int(raw_input("What's your age?: ")) +1))
>>56363654
Underrated
>>56365992
This seems legit. gg mr. one liner, gg.
>>56366279
Now let's see if someone does it with less characters, excluding the prompt strings
>>56366335
what if u put nigger for age
>>56363868
>my $name = <>;
>my $lenName = length $name;
>mfw people will actually defend these constructs
>>56363609int main (int age, char *name[])
{
printf("%d %d\n", strlen(*(name+1)), age+1);
return 0;
}
It doesn't work very well if the user is less than two years old.
>>56366526
the fuck
>>56366633
It's easy! For example, if you're 20, just run it like this:./a.out Anonymous fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 fizzbuzz 16 17 fizz 19 buzz
>>56366674
the fuck
>>56365774
Well you don't need the backticks with echo, do you.echo `expr length $name`
could just beexpr length $name
>>56364867
>>56364967
>>56365038
>>56365117
Doesn't work. It gives the SUM of name.length + parseInt(age) + 1.