All articles
c

A program to explain SIMPLE IF

Share this article

Share on LinkedIn Share on X (formerly Twitter)

C Programming Language 015

The following code shows how to write a program to explain SIMPLE IF

Program

#include <stdio.h>
 
void main()
{
    int age;
    printf("Enter age: ");
    scanf("%d", &age);
 
    if (age > 18)
    {
        printf("Eligible to vote");
    }
 
    printf("\n");
}

Result

Enter age: 35
Eligible to vote

Comments