Skip to content

apc-prac-015.c

Problem Statement

Write a program to display all numbers between lb (lower bound) and up (upper bound) which ends with digit 7 or divisible by 7.

Metadata

Property Detail
Author Amit Dutta (amitdutta4255@gmail.com)
License MIT

Actions

Raw View on GitHub

💡 You can print or save this file by opening Raw and using your browser.

Source Code

#include <stdio.h>

int main()
{
    int lb, ub, i;
    printf("Enter the lb, ub : ");
    scanf("%d %d", &lb, &ub);
    printf("\nEnds with 7 :");
    for (i = lb; i <= ub; i++)
    {
        if (i % 10 == 7)
        {
            printf("  %d", i);
        }
    }
    printf("\nDivisible by 7 :");
    for (i = lb; i <= ub; i++)
    {
        if (i % 7 == 0)
        {
            printf("  %d", i);
        }
    }
    return 0;
}