C - Write program to evaluate equation: 20 - 5 * 2 + 42 / 6

Requirements

Write a program that evaluates the following equation

20 - 5 * 2 + 42 / 6 

Displaying the result

Demo

#include <stdio.h>

int main()/* w  ww .  j av a 2  s.com*/
{
    int result;

    result=20-5*2+42/6;
    printf("20-5*2+42/6=%d\n",result);
    return(0);
}

Result

Related Exercise