/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/
#include<stdio.h>
main()
{
int x,y,i,sum=0;
scanf("%d%d",&x,&y);
if(x>y)
{
for(i=y;i<=x;i++)
{
if(i%13!=0)
{
sum=sum+i;
}
}
}
else if(y>x)
{
for(i=x;i<=y;i++)
{
if(i%13!=0)
{
sum=sum+i;
}
}
}
printf("%d\n",sum);
return 0;
}
//Happy_Coding
#include<stdio.h>
main()
{
int x,y,i,sum=0;
scanf("%d%d",&x,&y);
if(x>y)
{
for(i=y;i<=x;i++)
{
if(i%13!=0)
{
sum=sum+i;
}
}
}
else if(y>x)
{
for(i=x;i<=y;i++)
{
if(i%13!=0)
{
sum=sum+i;
}
}
}
printf("%d\n",sum);
return 0;
}
No comments:
Post a Comment