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<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.
}
}
for (i=0; i<1; ++i) puts ("1123581321");
for (i=0; i<1; ++i) puts ("1 232 34543 5678765");
#include int main (void) { int i; for (i=0;i<1;++i) puts ("1 121 12321 1234321"); return }
echo 'print a pattern'
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
write a program to print the series 1/12+1/22+.........+1/n2 ?
This is a directive, not a question.
#include
write a program to print A to Z on screen in c?
echo 'print a pattern'
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
write a program to print the series 1/12+1/22+.........+1/n2 ?
This is a directive, not a question.
good morning
Yes.
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.
include <stdio.h> int main (void) { puts ("print"); return 0; }
#include
Write a c program to print the 100 to 1 nos
a triangle then a square :)