/*Write a C program to find all
numbers which are dividing by
7 and the remainder is equal
to 2 or 3 between two given
integer numbers.
Test Data :
Input the first integer: 25
Input the second integer: 45
Expected Output:
30
31
37
38
44
*/
#include <stdio.h>
int main()
{
int num1,num2,sum=0,i;
printf("Input the first\
number: ");
scanf("%d",&num1);
printf("Input the second\
number: ");
scanf("%d",&num2);
if(num1>num2)
{
int temp=num1;
num1=num2;
num2=temp;
}
for(i=num1;i<num2;i++)
{
if(((i%7)==2)||((i%7)==3))
{
printf("%d\n",i);
}
}
return 0;
}
No comments:
Post a Comment