Computer Science, asked by gurvinderSingh9972, 8 months ago

Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, between 202 and 320 (both included)

Answers

Answered by codiepienagoya
0

To check given in range that value is divisible by 7 and not a multiple of 5.

Output:

203

217

224

231

238

252

259

266

273

287

294

301

308

Explanation:

program to check given in range that value is divisible by 7 and not a multiple of 5.

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

int t2; //defining integer variable

for(t2=202;t2<=320;t2++) //loop for count 202 to 320

{

if((t2%7==0)&(t2%5!=0)) //check value is divisible by 7 and not a multiple of 5

{

cout<<t2<<endl; //print calculated value

}

}

return 0;

}

Description of above program:

  • The first header file is included in the above C++ language code, then the main method is specified, all calculation is done inside this.
  • In the main method, an integer variable "t2" is declared, which is used in the for loop to count all values.
  • Inside this loop, the if block is used, that uses AND operator is used for check two conditions at a time, that is "value is divisible by 7 and not a multiple of 5", inside the loop the print function "cout" is used, that print the calculated value.

Learn more:

  • Program in C: brainly.in/question/14470592
  • Calculate velocity in C: brainly.in/question/15376188#
Similar questions