3-9. Print the exclusive multiple of two numbers
After inputting two numbers, print out all the numbers from 1 to 100 that are multiples of only one of the two numbers. That is, a number that is a common multiple of the two numbers should not be output.
For example, if 15 and 20 are input, "15, 20, 30, 40, 45, 75, 80, 90, 100" is output. (60 is not in the output)
For loops, use the 'for' statement, and use variables as follows.
int num1, num2; // two numbers entered int i; // variable for iterationExample of execution)
Enter 2 numbers 15 20 15 20 30 40 45 75 80 90 100
I recently started to learn c programming and this is the question I have tried to solve the question but my code does not work properly can somebody help me with this question? thank you so much
this is the code I have tried
enter code here
#include <stdio.h>
int main(void) {
int num1,num2;
int i=1;
int result1;
int result2;
printf("Enter 2 numbers \n");
scanf("%d %d",&num1,&num2);
for(i=1;i>0;i++){
if(num1*i<=100&&num2*i<=100){
if((num1*i%num2!=0)&&(num2*i%num1!=0)){
printf("%d\n",num1*i);
printf("%d\n",num2*i);
}
else if((num2*i%num1==0)&&(num1*i%num2!=0))
printf("%d\n",num1*i);
else if((num1*i%num2==0)&&(num2*i%num1!=0))
printf("%d\n",num2*i);
}
else if((num1*i>100&&num2*i<=100)&& (num2*i%num1!=0&&num1*i%num2==0))
printf("%d\n",num2*i);
else if((num2*i>100&&num1*i<=100)&&(num1*i%num2!=0&&num2*i%num1==0))
printf("%d\n",num1*i);