4.) Program to print the square of given range of numbers.


// Program to print the square of given range of numbers.
#include <stdio.h>
#include <conio.h>
#include <math.h>

int main()
{
    int beg, end, i, sq;
    printf("Enter the range you can find the square of the number:\n");
    scanf("%d%d", &beg, &end);
    for (i = beg; i <= end; i++)
    {
        sq = pow(i, 2);
        printf("square of %d is %d\n", i, sq);
    }
    return 0;
}

Output:
Enter the range you can find the square of the number: 5 10 square of 5 is 25 square of 6 is 36 square of 7 is 49 square of 8 is 64 square of 9 is 81
***** Thank You *****
any doubt please comment .

Comments

Popular posts from this blog

18 Amazing programs in C.