0 votes 0 votes "a healthy mind resides in a healthy body" Programming in C programming-in-c output + – Desert_Warrior asked Jun 17, 2016 Desert_Warrior 677 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 2 votes 2 votes In kth loop the value of d = 10. now when k=31 , the condition will be false.. then j will be incremented (j=2)... when j=1 then d=10. .. {condition is (j<31)} for j=30 ..d=10*30 = 300..ok..?? similarly, i=30..d = 300 * 30= 9000 dhairya answered Jun 17, 2016 • selected Jun 17, 2016 by Desert_Warrior dhairya comment Share Follow See all 6 Comments See all 6 6 Comments reply shekhar chauhan commented Jul 13, 2016 reply Follow Share @dhairya @Lord_Krishna can anyone of you explain what is this computation all about and how did we get d=10 I did not understand anything in this solution.........can someone help me ? 0 votes 0 votes dhairya commented Jul 13, 2016 reply Follow Share Shekhar... See .. initially d=0.. i=1, j=`1 , k=1 when we enter into k loop... { if(( i+j+k) %3 )== 0 } Now 1+1+1=3 which is divisible by 3...so the statement is true.. so, d=d+1 .... Now d=1..ryt........?? then we will go back to k loop... and k= k+1 .. now k=2 then for...{ if(( i+j+k) %3 )== 0 } vale= 1+1+2 = 4 which is not visible by 3 so, it will "not" execute d=d+1; So d=1 Then again k=k+1... k=3 for...{ if(( i+j+k) %3 )== 0 } value= 1+1+3=5 again not div by 3 Again value of k =k+1....k=4 Now..see what happen... for...{ if(( i+j+k) %3 )== 0 } value= 1+1+4 =6 which is divisible by 3 now the statement d=d+1 will be executed so d=2........ryt......??? .... .... after executing k loop ...we will get d=10... ok......???? 1 votes 1 votes shekhar chauhan commented Jul 13, 2016 reply Follow Share thanks for explanation can you please explain this one also for j=30 ..d=10*30 = 300..ok..?? if we are going from j=1 to j=30 how d getting multiplied. with 30 I always had trouble understanding these questions 0 votes 0 votes dhairya commented Jul 13, 2016 reply Follow Share Yes, for j ..d=10*30.. see what happens, when 1st tym j will be executed that is... j=1.. then k= 1 to 30... and ..d = 10... (this is thing which i explained u earlier ..ok..? ) then j= 2 then also k= 1 to 30... and ..d = 10+10 { for j=1 and j=2 } then, j=3 then same thing happen d=10 + 10 +10 { j=1 , 2, 3 } .. .. for j=30. .. d= 10 + 10 + 10 +..........+ 10 (30 times). { or simply multiply 10 with 30} ok....?? 1 votes 1 votes shekhar chauhan commented Jul 13, 2016 reply Follow Share @dhairya thanks again great explanation and efforts . 0 votes 0 votes dhairya commented Jul 13, 2016 reply Follow Share your Welcm..... 0 votes 0 votes Please log in or register to add a comment.