Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/
#include <stdio.h>
int main()
{
int a,b,c,d;
scanf("%d%d", &a, &b);
if(a<b)
{
for(c=a+1; c<b; c++)
{
if(c%5==2 || c%5==3)
printf("%d\n",c);
}
}
else if(a>b)
{
for(c=b+1; c<a; c++)
{
if(c%5==2 || c%5==3)
printf("%d\n",c);
}
}
return 0;
}
can u pls tell me why we added a+1 why not a;a<b;a++
ReplyDeleteI would like to know as well
Deletebecause it says between x&y, not including x&y
DeleteThanks for the answer. Makes sense
Delete