Start
print "the sum of all even numbers is infinite"
end
102
for (int i = 2; i < 10; i ++) printf("%d\n", i); You did say even and odd numbers between 1 and 10. That's allnumbers between 1 and 10.
sum = 0 for(n = 0; n <= 10; n += 2) sum += n;
1.start 2.n=1,s=0 3 compute s=s+n 4 compute n=n+1 5 check n<=10 go to step3 else go to step 7 6 display s 7 stop
write an algo to find the sum of even number from 1to n
jgfujtf
AnswerIf A=10, B=2... Then the algoritm is :-STEP1 : START.STEP2 : A=10.STEP3 : B=02.STEP4 : C=A-B.STEP5 : PRINT C.STEP6 : STOP.AnswerYou cannot print every even number in descending order, because there is no greatest even number. Or you want something like this: infinityinfinity-2infinity-4Answerstep 1: start step 2: Input Nstep 3: If N
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
102
#include(stdio.h) int main ()
Sum = 0 For N = 1 to 10 Sum = Sum + 2*N Next N Print Sum
To print even numbers in a loop in QBasic, you can use a FOR loop to iterate through a range of numbers and check if each number is even. An even number can be identified using the modulus operator (MOD). Here's a simple example: FOR i = 1 TO 20 IF i MOD 2 = 0 THEN PRINT i END IF NEXT i This code will print all even numbers from 1 to 20.
Reference:http:cprogramming-bd.com/c_page2.aspx# strange number
Well, honey, it's not rocket science. Just start at 2 and keep adding 2 until you hit 100. In programming terms, it's a simple loop that increments by 2 each time until you reach 100. So, get that code going and print those even numbers like a boss!
for (int i = 2; i < 10; i ++) printf("%d\n", i); You did say even and odd numbers between 1 and 10. That's allnumbers between 1 and 10.
It is 110.
In QBasic, you can print even numbers using a simple loop. For example, you can use a FOR loop to iterate through a range of numbers and then check if each number is even by using the modulus operator (MOD). Here's a sample code snippet: FOR i = 1 TO 20 IF i MOD 2 = 0 THEN PRINT i NEXT i This code will print all even numbers from 1 to 20.