C programming: Print this pattern 1 01 101 ...
plz help urgently to print patern
1
01
101
0101
by using for loops in C .... .......................
1
01
101
0101
by using for loops in C .... .......................
Replies
-
Kaustubh KatdareUmm, did you attempt the problem on your own? How about sharing what you've tried so far so that CEans here can help you correct it?
-
Jeffrey ArulrajHere is a logic in even digits of control variable print 0 and in odd value of control variable print 1
PS: Initialise control variable to 0 -
rahul69Here is another logic: keep concatenating a string with '0' and '1' alternatively and keep on printing the reverse of string ๐ .
PS: Initialize string to '1'. -
Nikhil LokhandeTry this one
for(i=0;ifor(j=0;j<=i;j++)
if(((i-j)%2)==0)
a[j]=1;
else
a[j]=0; -
Anoop Kumarhere is Algo
Outer_loop (int i=1; i
Inner_loop (j=i; j>0 ; j--)โprint (j%2);โend Inner_loopโprint (New_line);โend Outer_loop;
โ -
rahul69
Nice logic ! but I think it should be i< = NUMBER_OF_LINES instead of iianoophere is Algo
Outer_loop (int i=1; i
Inner_loop (j=i; j>0 ; j--)โprint (j%2);โend Inner_loopโprint (New_line);โend Outer_loop;
โAnoop Kumarrahul69Nice logic ! but I think it should be i< = NUMBER_OF_LINES instead of iYes.๐
You are reading an archived discussion.
Related Posts
I've been experimenting with the number of posts CEans would like to have on the site - 10 or 20? You decide. Currently we have 10 posts per page, so...
Source Internet:
Client side scripting is a script, (ex. Javascript, VB script), that is executed by the browser (i.e. Firefox, Internet Explorer, Safari, Opera, etc.) that resides at the user...
hi........can somebody explain how a bluetooth controlled helicopter works????
Looks as though a breakthrough in areal transport is imminent. Aeros have unveiled a working prototype of a lighter than air craft that bodes well to introduce a leisurely, luxurious...
Genome mapping is about to invade the cyberspace. Malware is the bane of the Internet. Currently one tries to develop anti malware cures after one surfaces.
Invincea labs in Fairfax,...