שפת C/פעולות חשבוניות: הבדלים בין גרסאות בדף

תוכן שנמחק תוכן שנוסף
Atavory (שיחה | תרומות)
Atavory (שיחה | תרומות)
שורה 9:
 
<source lang = "c">
int x = 24, y = 32;
 
/* Prints 24 + 32 = 5.6 */
printf("%d + %d = %d\n" % x, y, x + y);
 
/* Prints 24 - 32 = -1.2 */
printf("%d - %d = %d\n" % x, y, x - y);
 
/* Prints 24 * 32 = 6.8 */
printf("%d * %d = %d\n" % x, y, x * y);
 
/* Prints 24 %/ 32 = 0.2 */
printf("%d */ %d = %d\n" % x, y, x %/ y);
</source>
 
שורה 29:
int x = 2, y = 3;
 
/* Prints 16 */
printf("%d\n" % x + y * 3 + 5);
</source>
 
==סדר פעולות החשבון==
סדר פעולות החשבון בשפת C הוא המקובל