Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,297 members, 7,811,887 topics. Date: Sunday, 28 April 2024 at 10:20 PM

Simple Php Challenge - Programming (3) - Nairaland

Nairaland Forum / Science/Technology / Programming / Simple Php Challenge (9530 Views)

Please Help Me Write This Simple Php Switch Statement / Simple PHP Quiz: Kill The Rand() / Simple Php Quiz: Why Will This Code Not Work If You Are Uploading Files? (2) (3) (4)

(1) (2) (3) (4) (Reply) (Go Down)

Re: Simple Php Challenge by elvis10ten(m): 5:09pm On Jul 13, 2013
pc guru: Addition is compulsory what if i use Bit Shifting
nope. You must use only addition here, but you can also do that and show us atleast we can learn something from it cause i think we already have a winner.
Re: Simple Php Challenge by Nobody: 5:19pm On Jul 13, 2013
elvis10ten: nope. You must use only addition here, but you can also do that and show us atleast we can learn something from it cause i think we already have a winner.
Oops sorry i goofed it won't work, just tried it.
Re: Simple Php Challenge by Youngzedd(m): 5:51pm On Jul 13, 2013
Ajibel: Why only PDP what of oda langs.

APC will join soon.
Re: Simple Php Challenge by WhiZTiM(m): 6:18pm On Jul 13, 2013
spikes C:

Errrrmmm....i was saying java is cool.

Can u teach me Arabic grin
hahahaha. *falls off the tree.
Re: Simple Php Challenge by WhiZTiM(m): 6:27pm On Jul 13, 2013
Judinho59:
wink

Where's Whiztim when u need him?? angry
e be like sey some una conspire sey mek my phone spoil and mek MTN dey jonze me.
Haba, spikes C na Oga oh...
Bros, e be like sey u wan see stunts from me. Abeg, I am human.
How you doing??
Re: Simple Php Challenge by WhiZTiM(m): 6:34pm On Jul 13, 2013
spikes C:

He's already learning arabic. Watch out for his next post, he'll be writing from right to left grin



BTW, C++ rules tongue
*hahahahaha! #Oga spikes C don crack my ribs oh.

Oboi, that time never come... Its probably when I am faced with a problem in Java that I would learn Arabic writing and present my solution in Arabic.. . .#hehe
#i dey throw you salute!
Re: Simple Php Challenge by Nobody: 6:38pm On Jul 13, 2013
WhiZTiM:
e be like sey some una conspire sey mek my phone spoil and mek MTN dey jonze me.
Haba, spikes C na Oga oh...
Bros, e be like sey u wan see stunts from me. Abeg, I am human.
How you doing??

grin tongue
Re: Simple Php Challenge by WhiZTiM(m): 6:49pm On Jul 13, 2013
here is my solution! ...in Python 2.7

print range(7, 2101, 7)


Python 3 will be

print ([x for x in range(7, 2101, 7)])

I am on an old mobile phone now... Cant IDEOne it yet.

The solution I would have presented in C++, that follows the rules; has already been presented...!
Thats why, I decided to make my solution shortest... Ohkay, I agree not a solution but an answer.
And I used the language best suited for 'my goal' AND this exact problem...

#PythonSquad.

BTW, C++ rules. tongue... (#looksForTrouble)
Re: Simple Php Challenge by spikesC(m): 7:12pm On Jul 13, 2013
Mogbe ooooo grin

I have not seen a solution in Java ooo. That one go be 2 pages lipsrsealed

Besides, oga Whiztim, ur sollution does not follow d rules undecided



C++ rules
Re: Simple Php Challenge by WhiZTiM(m): 7:50pm On Jul 13, 2013
spikes C: Mogbe ooooo grin

I have not seen a solution in Java ooo. That one go be 2 pages lipsrsealed

Besides, oga Whiztim, ur sollution does not follow d rules undecided


C++ rules
. . . Yes I know... That is why i wrote.
WhiZTiM:
The solution I would have
presented in C++, that follows the
rules; has already been presented...!
Thats why, I decided to make my
solution shortest... Ohkay, I agree
not a solution but an answer. And I used the language best suited
for 'my goal' AND this exact
problem...
Re: Simple Php Challenge by naijainfogalery: 8:05pm On Jul 13, 2013
its always better you know the basics first start with w3schools.com or code.org
Abu Mikey: [size=64pt]I take God beg una,Make person volunteer to teach me Programming abeg!!![/size]
Re: Simple Php Challenge by ablyguy(m): 8:06pm On Jul 13, 2013
Too easy man! Bring something more challenging. Make it an algorithm challenge. Don't restrict it to a particlular language...
Re: Simple Php Challenge by humanbean: 8:09pm On Jul 13, 2013
WhiZTiM:
. . . Yes I know... That is why i wrote.


. . . Yes I know... That is why i wrote.
[/quote]

Oga WhiZTiM I don present for Py na tongue. Make me sef find small trouble. Abeg who fit code dis tin in assembly language? cheesy
Re: Simple Php Challenge by laykhorn(m): 8:10pm On Jul 13, 2013
Boll2010: bro u can do ursef good by downloadn vid tutorials on youtube notin u tinkn 4 nw dt oyinbos avnt done so use wat uv got 4 nw,no 1 tot me web designin,netwrkn,n sql database atleast I can handle stuffs wit wat I learnt,no 1 is collectin my money no more.
I've been having problems tryin to download from youtube... Can you tell me the procedures required. Please!!
Re: Simple Php Challenge by ablyguy(m): 8:11pm On Jul 13, 2013
obadiah777: LMAO. BROS THIS PROGRAMMING THING NO BE SMALL THING OOO. SOME PEOPLE THINK IN NUMBERS. THOSE ARE THE ONLY PEOPLE WHO WILL BE GOOD AT IT.

Numbers have very little to do with it. If you're very good at reasoning logically, you'll be good at it...
Re: Simple Php Challenge by Burger01(m): 8:16pm On Jul 13, 2013
spikes C:

Errrrmmm....i was saying java is cool.




Can u teach me Arabic grin
grin
Re: Simple Php Challenge by Burger01(m): 8:19pm On Jul 13, 2013
spikes C:

He's already learning arabic. Watch out for his next post, he'll be writing from right to left grin



BTW, C++ rules tongue
grin
Oboy, you funny no be small. Na programming make you this way?
Re: Simple Php Challenge by WhiZTiM(m): 8:21pm On Jul 13, 2013
spikes C: Mogbe ooooo grin

I have not seen a solution in Java ooo. That one go be 2 pages lipsrsealed

Besides, oga Whiztim, ur sollution does not follow d rules undecided

C++ rules
#hehe... You are looking for trouble ohh.
Re: Simple Php Challenge by sway112: 8:22pm On Jul 13, 2013
Pls am new beginner in programming I use c++

#include<iostream>
Using namespace std;
Int main()
{ Int n,sum=0, count;
For(n = 7, count=1; count<301; count++)
{ Sum+= n;
Cout<<"7 * "<<n<<" = "<< sum<< endl;
}
Return 0;
}
Re: Simple Php Challenge by elvis10ten(m): 8:26pm On Jul 13, 2013
ablyguy: Too easy man! Bring something more challenging. Make it an algorithm challenge. Don't restrict it to a particlular language...
just like the topic says its a simple challenge. Atleast attempt it before you say its simple, there are better ways to solve or achieve this and don't use other people solution.
Re: Simple Php Challenge by Nobody: 8:29pm On Jul 13, 2013
angry angry @Whiztim nd Spikes.. Una no well at al grin

http://ideone.com/gbJFDO

public class Main{
public static void main(String[] args){
int n = 7;

for(int j = 1; j < 301; j++){
System.out.println("7 x "+ j +" = " + n);
n +=7;
}
}
}


(Addition is compulsory, no Bitwise shifting)

#TeamJava cool
Re: Simple Php Challenge by spikesC(m): 8:59pm On Jul 13, 2013
Judinho59: angry angry @Whiztim nd Spikes.. Una no well at al grin

http://ideone.com/gbJFDO

public class Main{
public static void main(String[] args){
int n = 7;

for(int j = 1; j < 301; j++){
System.out.println("7 x "+ j +" = " + n);
n +=7;
}
}
}


(Addition is compulsory, no Bitwise shifting)

#TeamJava cool

What is this
They said a simple challenge that would not hurt the cpu grin

Declaring classes up and down grin
Re: Simple Php Challenge by Nobody: 12:09am On Jul 14, 2013
Was learning html on w3schools.com abt a year ago, wasted my time
Btw Would dis php teach how hack
Re: Simple Php Challenge by Djtm(m): 12:24am On Jul 14, 2013
humanbean:


. . . Yes I know... That is why i wrote.


Oga WhiZTiM I don present for Py na tongue. Make me sef find small trouble. Abeg who fit code dis tin in assembly language? cheesy

assembly language? WTF? Just how many pages will you use?
Mov bull, shit
Re: Simple Php Challenge by Djtm(m): 12:25am On Jul 14, 2013
Promhize: Was learning html on w3schools.com abt a year ago, wasted my time
Btw Would dis php teach how hack

wasted your time?? Guess you were not practising enough.
Re: Simple Php Challenge by humanbean: 12:56am On Jul 14, 2013
Djtm:

assembly language? WTF? Just how many pages will you use?
Mov bull, shit


from sys import exit
print "Hehehehehehehehehe."
print "Mission accomplished. Trouble found."
exit (0)

1 Like

Re: Simple Php Challenge by humanbean: 1:26am On Jul 14, 2013
humanbean: Just started delving into programming. I don't know PHP but I took up your challenge in Python. The code is a function to accept any number from the user and output any number of multiples he desires. I used a for loop and addition as you asked, but I don't know how to test the cpu load. The main code is about 4 lines. Please point out how I can optimise this.

figure = int(raw_input( "Number: " ))
multiple = int(raw_input( "How many multiples?: " ))
initial = figure
for i in range (0, multiple):
print figure
figure += initial

So I rewrote the code for IDEOne.

initial = 7
figure = initial
for i in range (0, 300):
print "7 x %d = %d" % (i+1,figure)
figure += initial

Results are here - http://ideone.com/FlsbRi
(Summary - time: 0.01s, memory: 7728 kB)
Re: Simple Php Challenge by hammedkola(m): 6:48am On Jul 14, 2013
humanbean: Just started delving into programming. I don't know PHP but I took up your challenge in Python. The code is a function to accept any number from the user and output any number of multiples he desires. I used a for loop and addition as you asked, but I don't know how to test the cpu load. The main code is about 4 lines. Please point out how I can optimise this.

figure = int(raw_input( "Number: " ))
multiple = int(raw_input( "How many multiples?: " ))
initial = figure
for i in range (0, multiple):
print figure
figure += initial


You try, but this is a copy and paste job, you didn't type it here
Re: Simple Php Challenge by elvis10ten(m): 10:20am On Jul 14, 2013
JUDINHO is the winner of this challenge. His php code runs properly and he followed the rules. @others that tried this, you also tried and most of you got it.
Now we all know(if you don't already know) the relationship between addition and multiplication and also you got to know about www.ideone.com and its usefulness. Have a nice day all.
Re: Simple Php Challenge by spikesC(m): 10:42am On Jul 14, 2013
elvis10ten: JUDINHO is the winner of this challenge. His php code runs properly and he followed the rules. @others that tried this, you also tried and most of you got it.
Now we all know(if you don't already know) the relationship between addition and multiplication and also you got to know about www.ideone.com and its usefulness. Have a nice day all.

wtf
Re: Simple Php Challenge by elvis10ten(m): 10:48am On Jul 14, 2013
spikes C:

wtf
wat ?. I told u to correct your code but you refused.
Re: Simple Php Challenge by spikesC(m): 10:54am On Jul 14, 2013
elvis10ten: wat ?. I told u to correct your code but you refused.

yes sir

(1) (2) (3) (4) (Reply)

I Need Help With This Adobe Master Collection Software / Application Development Using Csharp (C#) / Help On Java

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 35
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.