Write a C Program to print fibonacci series of 10 numbers using goto statement

#include <stdio.h>
/* Program to print fibonacci series of
10 numbers using goto statement.

In fibonacci series next number is the
sum of previous 2 numbers */
void main()
{
// 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
int no=3,x3, x1=0,x2=1;
printf(“%d”,x1);
printf(” %d”,x2);
repeat:
x3 = x1+x2;
printf(” %d”,x3);
x1=x2;
x2=x3;
if(no++<10)
goto repeat;
}

 

For Life time valid video tutorials of “C Programming For Beginners” course with quiz and certification : Click Here

Downloadable video tutorials of “C Programming For Beginners” for TTRC Player : Click Here

My Self Subrat Dash. I have completed my MSc in Information Technology. Since last 12 years i am teaching Math and Computer at TTRC Computer Institute situated at Rayagada, Odisha, India. I believe in conceptual learning, so i explain each and every concept with demos and examples, which makes it easier to understand.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!