what does \n and %d mean?
Here, in C programming \n is an escape character that helps to create a new line whereas %d is a format specifier that allows to specify only Integer values.
WAP to print the following series:
2, 2, 4, 6 up to 10th term.
The following is a program to print the following series:
2, 2, 4, 6 up to 10th term..
In JAVASCRIPT
let a = [2]
const b = 9
for (let i=2; i <= b; i+=2) {
a.push(i)
}
console.log(a)
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main() {
int i, nextTerm;
int t1 = 2, t2 = 2;
nextTerm = t1+t2;
printf("%d, %d, ", t1, t2);
for (i = 3; i <= 10; ++i) {
printf("%d, ", nextTerm);
t1 = t2;
t2 = nextTerm;
nextTerm = t1 + t2;
}
return 0;
}