answersLogoWhite

0


Best Answer

#include #include
#define N 100 /* change the upper limit by changing value of N */
int main()
{
int i;
clrscr();
printf("\nPROGRAM TO PRINT NUMBERS DIVISIBLE BY 8 between 1 and 100\n");
for(i=1;i<=N;i++)
{
if(i%8==0)
{
printf("%d\n",i);
}
}
getch();
return 0;
}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to print nos divisible by 8?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a c program to print 1 232 34543 5678765 using for loop?

If you visualize 1123581321 as a set of numbers (without spaces in between) instead of one number, you'll see that it's a set of the first 8 Fibnocci nos. - 1 1 2 3 5 8 13 21. The following program would print the required no. using a For looping structure. int main (void) { int i=1; int j=1; int k, num=1; for(k=0; k&lt;7; k++){ if(k==0){ printf("%d", num); } printf("%d", num); //next no. is the sum of previous two nos. in the series i=j; j=num; num=i+j; // 1 + 1 = 2 ... 1 + 2 = 3 ... 2 + 3 = 5 ... 3 + 5 = 8 // sum=i + j ... i takes value of j ... j takes value of sum ... repeat. } }


What is the function key to execute Qbasic program?

QBASIC operators are listed as follows.../along with some example QBASIC code... -&gt;LOGICAL OPERATORS AND OR NOT EXAMPLE QBASIC CODE:- A=1 B=1 IF (A AND B) THEN PRINT "Result: True" ELSE PRINT "Result: False" ...output... Result: True A=1 B=2 IF (A AND B) THEN PRINT "Result: True" ELSE PRINT "Result: False" ...output... Result: False -&gt; MATHEMATICAL OPERATORS + plus - minus * multiply / divide MOD division remainder ^ raise to the power EXAMPLE QBASIC CODE:- num1=4 num2=2 PRINT num1 + num2 PRINT num1 - num2 PRINT num1 * num2 PRINT num1 / num2 PRINT num1 MOD num2 PRINT num1 ^ num2 ...output... 6 2 8 2 0 16 -&gt; COMPARISON OPERATORS = equals &gt; greater than &lt; lesser than &gt;= greater than/or, equals &lt;= lesser than/or, equals &lt;&gt; not EXAMPLE QBASIC CODE:- num1 = 6 num2 = 8 IF num1 = num2 THEN PRINT "Equal to" IF num1 &gt; num2 THEN PRINT "Greater than" IF num1 &lt; num2 THEN PRINT "Lesser than" IF num1 &gt;= num2 THEN PRINT "Greater than/or, equal to" IF num1 &lt;= num2 THEN PRINT "Lesser than/or, equal to" IF num1 &lt;&gt; num2 THEN PRINT "NOT equal" ...output... Lesser than Lesser than/or, equal to NOT equal


How do you write a magic square program with basic?

AnswerYou're better off using a program like Visual Basic or C++ to do that. QBasic doesn't have very many capabilities.AnswerQBasic is quite capable. It is certainly capable of solving a magic squares problem.


Find the power of a positive integer in qbasic?

PROGRAMMING LANGUAGE: QBASIC/VERSION: QB64 ...Program code... intNum% = 2 CLS PRINT "PROGRAM: POWERS OF N/(N ="; intNum%; ")" PRINT FOR intEachLoopNum% = 0 TO 10 PRINT intNum%; " ^ "; intEachLoopNum%; " = "; intNum% ^ intEachLoopNum% NEXT ...Output... 2 ^ 0 = 1 2 ^ 1 = 2 2 ^ 2 = 4 2 ^ 3 = 8 2 ^ 4 = 16 2 ^ 5 = 32 2 ^ 6 = 64 2 ^ 7 = 128 2 ^ 8 = 256 2 ^ 9 = 512 2 ^ 10 = 1024 *NOTE*: In QBASIC the mathematical symbol: ^...means 'raise to the power of'; thus, 2 ^ 3; actually means raise the number 2 to the power of 3/or, 2 x 2 x 2.


How do you create a flowchart that will accept a number and print the integers and the product of the integers of the number?

1. Input number, n 2. a = 0 3. d = n % 10 4. Print d 5. a = a + d 6. n = n / 10 7. If n &gt; 0 then goto 3 8. Print a

Related questions

Their sum is 0, and the product is -64 what is the value of both number?

The nos. Are 8 and -8 Sum of the nos. 8+(-8)=0 Product of the nos. 8 × (-8) = -64


When is a number divisible by 8?

If the last 3 digits are divisible by 8, the number is divisible by 8.


What is a number that divisible by 2 and also divisible by 8?

no.. for example 6,12,18 are divisible by 2..but not divisible by 8.


Is 152 divisible by 8?

152 is divisible by 8, and the answer is 19.


Is 75 and 124 divisible by 8?

Neither is divisible by 8.


If a number is divisible by 2 and 4 is it divisible by 8?

Not always for example, 36 is not divisible by 8 but it is divisible by 2 and 4.


If 4 is divisible by a number will 8 be too?

4 is divisible by 1, 2 and 4. So is 8. If a number is divisible by 8, it will also be divisible by 4.


Can a number be divisible by 6 and 8 without being divisible by 6 times 8 equals 48?

Yes - 24 is divisible by both 6 and 8 - but is NOT divisible by 48


Is 8 divisible by 4?

Yes. 8 / 4 = 2 8 is also divisible by 2 and 8.


All numbers divisible by 8 and 12 are also divisible by?

All numbers that are divisible by 8 and 12 would also be divisible by 4.


How do you know what is divisible by 8?

If you have a few different numbers that you are using, divide them each by 8 and if you get a whole number, that number is divisible. If you are trying to figure out what is divisible by 8, you can use a divisibility test.A number is divisible by 8 if:the number formed by the last three digits is divisible by 8.So, an example of this would be:7, 120.This number is divisible by 8 because 120 (the last 3 digits) is divisible by 8!


How do you know when a number is divisible by 8?

Numbers are divisible by 8 if the number formed by the last three individual digits is evenly divisible by 8. For example, the last three digits of the number 3624 is 624, which is evenly divisible by 8 so 3624 is evenly divisible by 8.