Integer between 1 to 100 that are not divisible by 7,11or13
Answers
Answered by
0
Print value between 1 to 100 which is divisible by 7, 11, and 13.
Output:
show the image.
Explanation:
Program to print value between 1 to 100 which is divisible by 7, 11, and 13.
Program:
#include <iostream> //defining header file
using namespace std;
int main() //defining main method
{
int x1; //defining integer variable
for(x1=1;x1<=100;x1++) //loop for count 1 to 100
{
if((x1%7!=0)&(x1%11!=0)&(x1%13!=0)) //check value is not divisible by 7,11,and 13.
{
cout<<x1<<", "; //print calculated value
}
}
return 0;
}
Description of the above codes as follows:
- In the above code main method is declared inside this method an integer variable x1 is defined, which is used in the for loop.
- In the for it start from 1 and end with 100, in this loop if block is defined that checks value of value is not divisible by 7, 11 and 13.
- To check all conditions at a time AND operator is used that print all values at a time.
Learn more:
- Value is divisible by 7: https://brainly.in/question/15376191
Attachments:
Similar questions