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()/*from w w w. j a v  a  2s.  c  om*/
{
    int result;

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

Result

Related Exercise