OCJP

Sum of digits Between 1 to 100 divided By 4

#include<stdio.h>
#include<conio.h>
void main()
{
int x=1;
int sum=0;
clrscr();
while(x<=100)
{

	if(x%4==0)
	{
	printf("\ndiveded by 4 between 0 to 100 :%d",x);
	sum=sum+x;
	}
x++;
}
printf("\nsum is : %d",sum);

getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *


× How can I help you?