Showing posts with label age checker in c++. Show all posts
Showing posts with label age checker in c++. Show all posts

Wednesday, March 1, 2017

Persons Age Checker in C

In this article I would like to share with you a very simple program that teacher you how to use if - else statement in C. What does the program will do is to ask the persons age and then our program will check if the age of the person is already an adult or still a minor. I wrote this code using CodeBlocks 16.1 as my text editor and Dev C++ as my C compiler. I hope you will find my work useful. Thank you. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output



Program Listing

/* Persons Age Checker in C */
/* Author  : Mr. Jake R. Pomperada, MAED-IT   */
/* Date    : March 1, 2017  Wednesday         */
/* Tools   : CodeBlocks 16.1                  */
/* Country : Philippines                      */


#include <stdio.h>

int age = 0;

int main()
{
    printf("\n\n");
    printf("\t===== PERSONS AGECHECKER IN C =====");
    printf("\n\n");
    printf("What is your age : ");
    scanf("%d",&age);

    if (age >= 18 ) {
        printf("\n\n");
        printf("At the age of %d you are already an ADULT.",age);
      }

    else {
        printf("\n\n");
        printf("At the age of %d you are still a MINOR.",age);
      }
    printf("\n\n");
    printf("END OF PROGRAM");
    printf("\n\n");
}