Here you go in C code http://codepad.org/gk6AZj0T
int main() { if(printf("hello")!=0) { printf("world"); } else { printf("SCREWED ! ! !"); } return 0; } * * * * *Subhransu Panigrahi * *Mobile:* *+91-9840931538* *Email:* subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar <naveenkumarve...@gmail.com>wrote: > Hi Shachindra, > I don't think letters will be jumbled because we a calling one api to > output on console & tty's driver takes whole line and output it at once. > > On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki <vishaltha...@gmail.com>wrote: > >> @sachindra, @naveen, >> this was just a plain trick to execute "if" and "else" block. i agree >> with your concerns :) >> >> 2011/6/3 Vιиodh <vinodh...@gmail.com>: >> > @vishal: >> > can u explain the fork() solution?? >> > >> > On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C <sachindr...@gmail.com> >> > wrote: >> >> >> >> There can be some synchronisation problems with fork() right? say world >> >> might get printed first...or maybe the letters can get jumbled too...We >> >> cannot guarantee the order of execution unless we use semaphores. >> >> >> >> On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar < >> naveenkumarve...@gmail.com> >> >> wrote: >> >>> >> >>> oh yes, >> >>> gud one >> >>> >> >>> On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki < >> vishaltha...@gmail.com> >> >>> wrote: >> >>>> >> >>>> vishal@ubuntu:~/progs/c\ 12:11:53 PM >$ cat fork.c >> >>>> #include <stdio.h> >> >>>> #include <stdlib.h> >> >>>> >> >>>> int main() >> >>>> { >> >>>> if (fork()) { >> >>>> printf("hello "); >> >>>> } else { >> >>>> printf("world\n"); >> >>>> } >> >>>> return 0; >> >>>> } >> >>>> vishal@ubuntu:~/progs/c\ 12:11:56 PM >$ gcc fork.c >> >>>> vishal@ubuntu:~/progs/c\ 12:12:06 PM >$ ./a.out >> >>>> hello world >> >>>> >> >>>> >> >>>> On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar >> >>>> <naveenkumarve...@gmail.com> wrote: >> >>>> > Hi Vishal, >> >>>> > >> >>>> > Can you show us how it be done with fork? >> >>>> > >> >>>> > On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki >> >>>> > <vishaltha...@gmail.com> >> >>>> > wrote: >> >>>> >> >> >>>> >> can use fork() also.. >> >>>> >> >> >>>> >> On Fri, Jun 3, 2011 at 11:57 AM, anand karthik >> >>>> >> <anandkarthik....@gmail.com> wrote: >> >>>> >> > (!printf("Hello")) >> >>>> >> > >> >>>> >> > On Jun 3, 2011 11:52 AM, "Arpit Mittal" < >> mrmittalro...@gmail.com> >> >>>> >> > wrote: >> >>>> >> >> Please help me in this question. >> >>>> >> >> >> >>>> >> >> What's the "condition" so that the following code prints both >> >>>> >> >> HelloWorld ! >> >>>> >> >> >> >>>> >> >> if "condition" >> >>>> >> >> printf ("Hello"); >> >>>> >> >> else >> >>>> >> >> printf("World"); >> >>>> >> >> >> >>>> >> >> >> >>>> >> >> >> >>>> >> >> >> >>>> >> >> -- >> >>>> >> >> -Arpit Mittal >> >>>> >> >> 6th Semester, >> >>>> >> >> Indian Institute of Information Technology,Allahabad >> >>>> >> >> Email : arpitmittal.ii...@gmail.com >> >>>> >> >> rit2008...@iiita.ac.in >> >>>> >> >> Contact : +91-8853049787 >> >>>> >> >> >> >>>> >> >> Let every man be respected as an individual and no man >> idolized. >> >>>> >> >> >> >>>> >> >> -- >> >>>> >> >> You received this message because you are subscribed to the >> Google >> >>>> >> >> Groups >> >>>> >> >> "Algorithm Geeks" group. >> >>>> >> >> To post to this group, send email to >> algogeeks@googlegroups.com. >> >>>> >> >> To unsubscribe from this group, send email to >> >>>> >> >> algogeeks+unsubscr...@googlegroups.com. >> >>>> >> >> For more options, visit this group at >> >>>> >> >> http://groups.google.com/group/algogeeks?hl=en. >> >>>> >> >> >> >>>> >> > >> >>>> >> > -- >> >>>> >> > You received this message because you are subscribed to the >> Google >> >>>> >> > Groups >> >>>> >> > "Algorithm Geeks" group. >> >>>> >> > To post to this group, send email to algogeeks@googlegroups.com >> . >> >>>> >> > To unsubscribe from this group, send email to >> >>>> >> > algogeeks+unsubscr...@googlegroups.com. >> >>>> >> > For more options, visit this group at >> >>>> >> > http://groups.google.com/group/algogeeks?hl=en. >> >>>> >> > >> >>>> >> >> >>>> >> -- >> >>>> >> You received this message because you are subscribed to the Google >> >>>> >> Groups >> >>>> >> "Algorithm Geeks" group. >> >>>> >> To post to this group, send email to algogeeks@googlegroups.com. >> >>>> >> To unsubscribe from this group, send email to >> >>>> >> algogeeks+unsubscr...@googlegroups.com. >> >>>> >> For more options, visit this group at >> >>>> >> http://groups.google.com/group/algogeeks?hl=en. >> >>>> >> >> >>>> > >> >>>> > >> >>>> > >> >>>> > -- >> >>>> > Cheers >> >>>> > Naveen Kumar >> >>>> > >> >>>> > -- >> >>>> > You received this message because you are subscribed to the Google >> >>>> > Groups >> >>>> > "Algorithm Geeks" group. >> >>>> > To post to this group, send email to algogeeks@googlegroups.com. >> >>>> > To unsubscribe from this group, send email to >> >>>> > algogeeks+unsubscr...@googlegroups.com. >> >>>> > For more options, visit this group at >> >>>> > http://groups.google.com/group/algogeeks?hl=en. >> >>>> > >> >>>> >> >>>> -- >> >>>> You received this message because you are subscribed to the Google >> >>>> Groups "Algorithm Geeks" group. >> >>>> To post to this group, send email to algogeeks@googlegroups.com. >> >>>> To unsubscribe from this group, send email to >> >>>> algogeeks+unsubscr...@googlegroups.com. >> >>>> For more options, visit this group at >> >>>> http://groups.google.com/group/algogeeks?hl=en. >> >>>> >> >>> >> >>> >> >>> >> >>> -- >> >>> Cheers >> >>> Naveen Kumar >> >>> >> >>> -- >> >>> You received this message because you are subscribed to the Google >> Groups >> >>> "Algorithm Geeks" group. >> >>> To post to this group, send email to algogeeks@googlegroups.com. >> >>> To unsubscribe from this group, send email to >> >>> algogeeks+unsubscr...@googlegroups.com. >> >>> For more options, visit this group at >> >>> http://groups.google.com/group/algogeeks?hl=en. >> >> >> >> >> >> >> >> -- >> >> Regards, >> >> Shachindra A C >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups >> >> "Algorithm Geeks" group. >> >> To post to this group, send email to algogeeks@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> algogeeks+unsubscr...@googlegroups.com. >> >> For more options, visit this group at >> >> http://groups.google.com/group/algogeeks?hl=en. >> > >> > >> > >> > -- >> > With regards, >> > Vιиodh >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Algorithm Geeks" group. >> > To post to this group, send email to algogeeks@googlegroups.com. >> > To unsubscribe from this group, send email to >> > algogeeks+unsubscr...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/algogeeks?hl=en. >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > Cheers > Naveen Kumar > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.