EN` Posted October 11, 2009 Report Share Posted October 11, 2009 Ir iespejams kaut kaa likt atnjemt no kkada skaitla liidz 0, un tad lai neiet -1;-2, bet gan 6. piemeram 0-1=6 Quote Link to comment Share on other sites More sharing options...
0 Aleksejs Posted October 11, 2009 Report Share Posted October 11, 2009 if(skaitlis - 1 < 0){ skaitlis = 6 } else { skaitlis = skaitlis - 1 } Quote Link to comment Share on other sites More sharing options...
0 EN` Posted October 11, 2009 Author Report Share Posted October 11, 2009 if(skaitlis - 1 < 0){ skaitlis = 6 } else { skaitlis = skaitlis - 1 } Paldies! Quote Link to comment Share on other sites More sharing options...
0 Aleksejs Posted October 11, 2009 Report Share Posted October 11, 2009 Kaut gan, iespējams (ja esmu pareizi uzminējis ko Tev vajag), ka to visu var uzrakstīt vienā rindiņā: skaitlis = (skaitlis - 1) % 7 Quote Link to comment Share on other sites More sharing options...
0 marcis Posted October 11, 2009 Report Share Posted October 11, 2009 Es gan drošvien darītu šādi: skaitlis = skaitlis - 6 if(skaitlis < 0){ skaitlis = 0 } Quote Link to comment Share on other sites More sharing options...
0 waplet Posted October 11, 2009 Report Share Posted October 11, 2009 viņam jau vajag atņemt vienu un ja pēc atņemšanas skaitlis ir mazāk par 0 tad skaitli ielikt par 6 Quote Link to comment Share on other sites More sharing options...
0 marcis Posted October 11, 2009 Report Share Posted October 11, 2009 Nu tad pārbaudi: ja ir mazāks par 6 -> ieseto 6 Quote Link to comment Share on other sites More sharing options...
0 v3rb0 Posted October 12, 2009 Report Share Posted October 12, 2009 (_ = skaitlis - 1234) < 0 ? 6 : _; Quote Link to comment Share on other sites More sharing options...
Question
EN`
Ir iespejams kaut kaa likt atnjemt no kkada skaitla liidz 0, un tad lai neiet -1;-2, bet gan 6.
piemeram 0-1=6
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.