Skip to content

Instantly share code, notes, and snippets.

@btechmag
Created April 29, 2021 08:35
Show Gist options
  • Save btechmag/b3aab9a910ced35232dc254f909fd698 to your computer and use it in GitHub Desktop.
Save btechmag/b3aab9a910ced35232dc254f909fd698 to your computer and use it in GitHub Desktop.
C Program that prints all even numbers between 1 and 50.
#include<stdio.h>
int main()
{
//Program that prints all even numbers between 1 and 50
int i;
printf("The even numbers between 1 to 50 are: \n");
for(i = 1; i <= 50; i++)
{
if(i % 2 == 0)
{
printf("%d ",i);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment