C语言运算符优先级

#include stdio.hmain() {int a = 20;int b = 10;int c = 15;int d = 5;int e;e = (a + b) * c / d;// ( 30 * 15 ) / 5

编程学习网为您整理以下代码实例,主要实现:C语言运算符优先级,希望可以帮到各位朋友。

@H_301_0@#include <stdio.h> main() { int a = 20; int b = 10; int c = 15; int d = 5; int e; e = (a + b) * c / d; // ( 30 * 15 ) / 5 printf("Value of (a + b) * c / d is : %d\n", e ); e = ((a + b) * c) / d; // (30 * 15 ) / 5 printf("Value of ((a + b) * c) / d is : %d\n" , e ); e = (a + b) * (c / d); // (30) * (15/5) printf("Value of (a + b) * (c / d) is : %d\n", e ); e = a + (b * c) / d; // 20 + (150/5) printf("Value of a + (b * c) / d is : %d\n" , e ); return 0; }
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐