• Language

    C

  • Description

    It asks the user for two numbers, and it says whether the first is a multiple of the second.

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, b;
    printf ("Enter the value of a: ");
    scanf ("%d", &a);
    (void) getchar ();
    printf ("Enter the value of b: ");
    scanf ("%d", &b);
    (void) getchar ();
    if(b%a==0)
        printf ("The first number is a multiple of the second one.\n");
    else
        printf ("The first number is not a multiple of the second one.\n");
    putchar ('\n');
    system ("pause");
    return EXIT_SUCCESS;
}