- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Print values of ‘a’ in equation (a+b) <= n and a+b is divisible by x
Given with equation program must find the value of ‘a’ where a+b<=n and also divisible by x.
Algorithm
START Step 1 -> Declare start variables b=10, x=9, n=40 and flag=0, divisible Step 2 -> Loop For divisible = (b / x + 1 ) * x and divisible <= n and divisible += x IF divisible - b >= 1 Print divisible-1 Set flag=1 End END STOP
Example
#include <stdio.h> int main(int argc, char const *argv[]) { int b=10, x=9, n=40, flag = 0; int divisible; for (divisible = (b / x + 1 ) * x ; divisible <= n; divisible += x) { if ( divisible - b >= 1) { printf("%d ", divisible - b ); flag = 1; } } return 0; }
Output
if we run above program then it will generate following output
8 17 26
- Related Articles
- How to print all the values of a dictionary in Python?
- C++ program to print values in a specified format
- How to print a large number of values in R without index?
- C program to print the ASCII values in a string.
- If $a = 3$ and $b =-2$, find the values of:$a^a+ b^b$
- If $a = 3$ and $b =-2$, find the values of:$a^b + b^a$
- Python Program to print unique values from a list
- C# program to print unique values from a list
- Java program to print unique values from a list
- Print hexadecimal values in Arduino
- Print binary values in Arduino
- In the following, determine whether the given values are solutions of the given equation or not: $a^2x^2 – 3abx + 2b^2 = 0, x = frac{a}{b}, x = frac{b}{a}$
- Write a program in Python to print dataframe rows as orderDict with a list of tuple values
- If $x=frac{2}{3}$ and $x=-3$ are the roots of the equation $ax^2+7x+b=0$, find the values of $a$ and $b$.
- If $a = 3$ and $b =-2$, find the values of:$(a+b)^{ab}$

Advertisements