c++ Problem
1:-Write a Program to print 1 to 100 ....without using any loop?
Replies
-
dipen30void main()
{
static int i = 1;
printf("%d ",i++);
if(i!=101)
main();
} -
Manish Goyal
Have you execute this code...?dipen30void main()
{
static int i = 1;
printf("%d ",i++);
if(i!=101)
main();
}
actually it is giving error in my computer...
check it out -
dipen30which error it gives can you tell me? because it runs in my pc.
-
Manish Goyal
Cannot call 'main' from withing in the program in function main();dipen30which error it gives can you tell me? because it runs in my pc.
and I am using Borland C++ Compiler 5.5 -
dipen30I am using Turbo c.
I think in your compiler we cannot call main within main. but this code is run correctly in my compiler.
Use turbo c to run this code. -
Prasad AjinkyaTry writing it as a recursive function and calling the function through main.
-
Prasad AjinkyaOne more - why not just print 1 to 100 ๐
-
Manish Goyal
nice one ...dude...๐๐kidakakaOne more - why not just print 1 to 100 ๐ -
silverscorpion
I thought the same after reading the question!! ๐kidakakaOne more - why not just print 1 to 100 ๐
You are reading an archived discussion.
Related Posts
Guys whenever i see the coding of any web page on a web Browser...I wondered why this line is written on start of any webpage...
why it is required...?Is it...
Guys I am not much aware of this...since years ago I heard something like
that we can make clouds to thunder according to our wish ..by puting some salt on...
A lady was driving along with her father.
They came upon a storm, and the young lady asked her father, What should I do?"
He said "keep driving". Cars began...
Hi, I am a Mechanical student, currently at my final year so I am to do my FYP aka Final Year Project with the title of hybrid power generator (solar...
CEans,
If you have been following our discussions in this sections, you might be aware that we're now starting to actively promote CE among colleges in India (to begin with...