| | |
Need help with php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2004
Posts: 1
Reputation:
Solved Threads: 0
hi ive been workingon some For loops an While Loops and Switch statements and i need so help with this one problem if you could help me that would be grate ive tried realy hard to do this on my own but cant figure it out thanks for helping
This is the frist one i need help with is how to print this uesing For loops
13579
1357
135
13
1
and this other one by useing If/Else i think
I have..........10 exercise routines left for the month!
This is the frist one i need help with is how to print this uesing For loops
13579
1357
135
13
1
and this other one by useing If/Else i think
I have..........10 exercise routines left for the month!
I think you should post in the programming section designated for php coding you would probably get more hits. It is in the forum index underneath scripting languages.
u must do something about ur programming concept. i meam, if u find this prog. to be tough then what about the tougher ones that are waiting for u in the near future.
to print the following format using for loop
13579
1357
135
13
1
u can take help of a nested loop
first start a for loop (say i) from (1 to c), where c=9, in the first case
and then inside that for loop create anothe for loop from (say j) (1 to i)
and now print j and outside the j loop print a new line and the decrease the value of c. i leave this on u. think by how much the value of c should be decrease to get the desired output.
best of luck!
to print the following format using for loop
13579
1357
135
13
1
u can take help of a nested loop
first start a for loop (say i) from (1 to c), where c=9, in the first case
and then inside that for loop create anothe for loop from (say j) (1 to i)
and now print j and outside the j loop print a new line and the decrease the value of c. i leave this on u. think by how much the value of c should be decrease to get the desired output.
best of luck!
while we're on the topic of scripting languages, here's a dirty hack in python:
PHP Syntax (Toggle Plain Text)
l = [] for i in range(1,10): if i % 2 != 0: l.append(i) for i in range(1,6)[::-1]: print "".join([str(x) for x in l[0:i]])
i'm not sure how my post is totally irrelevant. perhaps i shouldn't have said that we're on the "topic" of scripting languages, but instead that this is a thread in the c/c++ forum and i'm continuing with the off-forum-topic discussion.
anyways, that python code prints what you want. if you know python it will probably help you out when writing the php code.
anyways, that python code prints what you want. if you know python it will probably help you out when writing the php code.
![]() |
Similar Threads
- PHP / My SQL Web developer (Web Development Job Offers)
- Project available for PHP Developer (Web Development Job Offers)
- PHP/MySQL Programmer Position (Web Development Job Offers)
- Are you a PHP and Javascript junkie? It's time you met Emma. (Software Development Job Offers)
- PHP MYSQL Developer Position Available (Web Development Job Offers)
- PHP Web Programmer (Post your Resume)
Other Threads in the PHP Forum
- Previous Thread: I need help with a form please
- Next Thread: Access PostgreSQL from PHP
Views: 2014 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess 5.2.10 access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple mysql mysqlquery oop parse paypal pdf php problem query radio random record recursion regex remote script search security select server sessions sms soap sockets source space speed sql structure syntax system table thesishelp tutorial update updates upload url validation validator variable video web xml youtube






