• Language

    C

  • Description

    It inputs an even or an odd number through the keyboard, multiplies even with 5 and with 3 add both result. It subtracts the result from 1000 and finally it prints the difference.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
    int a_number, difference, result;
    printf ("Enter the value of a number: ");
    scanf ("%d", &a_number);
    (void) getchar ();
    if(a_number%2==0)
        result=a_number*5;
    else
        result=a_number*3;
    difference=1000-result;
    printf ("Value of difference: %d\n", difference);
    printf ("Value of result: %d\n", result);
    putchar ('\n');
    system ("pause");
    return EXIT_SUCCESS;
}