Created
May 5, 2021 04:44
-
-
Save btechmag/4d89a72c424126c3306b10a43bc49387 to your computer and use it in GitHub Desktop.
C Program to find and print the square of each one of the even values from 1 to a specified value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
//Program to find and print the square of each one of the even values from 1 to a specified value | |
int x, i; | |
printf("Input an integer: "); | |
scanf("%d", &x); | |
printf("List of square of each one of the even values from 1 to %d : \n", x); | |
for(i = 2; i <= x; i++) | |
{ | |
if((i % 2) == 0) | |
{ | |
printf("%d^2 = %d\n", i, i * i); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment