| | |
Tricky Questions
![]() |
•
•
Join Date: Jun 2006
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by ivanCeras
a sophisticated,convoluted code any other programmer make proud of .... is a bad programming practice... why not keep it simple and readable... <dietel & dietel books..>
main()
{
if(printf("Hello World"))
{
}
}
Last edited by Dave Sinkula; Jun 1st, 2006 at 10:27 am.
•
•
•
•
Originally Posted by Antonyraj
This is the program without using semicolon. Iam antony from india my mail id <<email snipped>> welcome some more queries.
main()
{
if(printf("Hello World"))
{
}
}
i m a bit late.
Antonyraj put the same code which otherwise i would have done.
Right now.... trying to solve the other one.
i think functions would be a way to solve it ........???
•
•
Join Date: Apr 2006
Posts: 26
Reputation:
Solved Threads: 0
I too failed to solve "A 'C' program without using any loop (if, for, while,etc...) to print numbers."
unless it is somthing like
Google nither helped. Any ideas ?
unless it is somthing like
C Syntax (Toggle Plain Text)
printf("1, 2, 3, 4....\n");
Google nither helped. Any ideas ?
•
•
•
•
Originally Posted by Narue
>Google nither helped.
I get the feeling you didn't look very hard. Have you considered recursion? What about goto? Neither of those are considered to be loop constructs.
I tried it and hey tlly i come up with the following code.......
May be this would suit ur expectatios to the best.So, check this out...
C Syntax (Toggle Plain Text)
#include<stdio.h> #include<conio.h> void main() { int n; int prno(); clrscr(); printf("\n Enter the no. upto which u want to print the no.="); scanf("%d",&n); n++; prno(n); getch(); } prno(int i); { i--; (i<=0)?printf("\n Thank u") : prno(i); printf("\n %d",i); return(i); }
Have fun with 'C'
:!: Last edited by Dave Sinkula; Jun 3rd, 2006 at 9:27 am.
•
•
Join Date: Apr 2006
Posts: 26
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Narue
>Google nither helped.
I get the feeling you didn't look very hard. Have you considered recursion? What about goto? Neither of those are considered to be loop constructs.
recursion was the seconed thing.
But in any case we are not allowed to test with "if".
I tought about simple condition like this
C Syntax (Toggle Plain Text)
i = ( i < 10 ) ? i+1 : i ;
I tought about macros. But thats using "if" and saying
"I am not using 'if'"
•
•
•
•
Originally Posted by dude543
But in any case we are not allowed to test with "if".
•
•
•
•
Originally Posted by tlly
2). A 'C' program without using any loop (if, for, while,etc...) to print numbers.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- C tricky questions (C++)
Other Threads in the C Forum
- Previous Thread: airlines reservation system
- Next Thread: Framework 2
| Thread Tools | Search this Thread |
#include * adobe ansi array asterisks bash binarysearch centimeter changingto char character cm convert copyimagefile cprogramme creafecopyofanytypeoffileinc database dynamic execv feet fgets file floatingpointvalidation fork function getlogicaldrivestrin givemetehcodez global grade gtkwinlinux hacking histogram ide inches include incrementoperators infiniteloop input interest intmain() iso kernel keyboard kilometer license linked linkedlist linux list locate looping lowest matrix meter microsoft number oddnumber opendocumentformat openwebfoundation owf pattern pdf performance pointer posix power probleminc process program programming radix recursion recv recvblocked research reversing scripting segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test threads turboc unix urboc user variable voidmain() wab whythiscodecausesegmentationfault windowsapi






