C Program for Zip, Zap and Zoom game

In this tutorial, i am going to show you how to write a program for zip, zap and zoom game in c.

Write a c program that displays a message as follows for a given number:

  • If it is a multiple of three, display “Zip”.
  • If it is a multiple of five, display “Zap”.
  • If it is a multiple of both three and five, display “Zoom”.
  • If it does not satisfy any of the above given conditions, display “Invalid”.

C Program for Zip, Zap and Zoom game

// Program to relate two integers using =, > or < symbol
#include <stdio.h>
int main() {
    int number;
    printf("Enter two integers: ");
    scanf("%d", &number);
    //checks if the two integers are equal.
    if(number%3 == 0 && number%5 == 0) {
        printf("zoom");
    }
    //checks if number1 is greater than number2.
    else if (number%5 == 0) {
        printf("zap");
    }
    //checks if both test expressions are false
    else if (number%3 == 0) {
        printf("zip");
    }  
    //checks if both test expressions are false
    else {
        printf("This number is not dividev by 3 and 5");
    }
    return 0;
}

The output of the above c program; is as follows:

Enter two integers: 15
zoom

More C Programming Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published.