notyabussines Posted April 2, 2013 Share Posted April 2, 2013 1)What is the output of this code fragment ? i=1; while (i<128) { printf ("%d,i) ; i *=2; } 2) What is the output of this code fragment? i=9384; do { printf ("%d",i ); i /=10; } while (i>0) ; 3)Same question for (i =5,j=i-1;i>0,j>0;--i,j=i-1) printf ("d",i);4)Same questionfor (i=10;i>=1,i /=2) printf("%d",i++) Link to comment Share on other sites More sharing options...
pwagen Posted April 2, 2013 Share Posted April 2, 2013 (edited) If this is homework, we're not supposed to help by doing your assignments for you. Have you tried running the code yourself? What output did you get? Try running it here, see what it does for yourself: http://codepad.org/ Edit: For clarity, add \n after %d, as such: "%d\n". Also, you'll need to put the code in a main function, just like a real program. Edited April 2, 2013 by pwagen Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now