Skip to main content

To Generate Fibonacci series using C

#include<stdio.h>
#include<conio.h>
void main()
{
   int f1=0, f2=1, f3, num, count=0;

   clrscr();
   printf("\nEnter a Number: ");
   scanf("%d", &num);
   printf("\n%d",f1);
   printf("\n%d",f2);
   count=2;
 
     while(count<num)
     {
         f3=f1+f2;
         count++;
         printf("\n%d",f3);
         f1=f2;
         f2=f3;
      }
   getch();
}



OUTPUT:

Enter a Number: 10

0
1
1
2
3
5
8
13
21
34

Comments

Popular posts from this blog

Creating a Realtime Clock using Python program

Clock from turtle import * from datetime import datetime def jump(distanz, winkel=0):     penup()     right(winkel)     forward(distanz)     left(winkel)     pendown() def hand(laenge, spitze):     fd(laenge*1.15)     rt(90)     fd(spitze/2.0)     lt(120)     fd(spitze)     lt(120)     fd(spitze)     lt(120)     fd(spitze/2.0) def make_hand_shape(name, laenge, spitze):     reset()     jump(-laenge*0.15)     begin_poly()     hand(laenge, spitze)     end_poly()     hand_form = get_poly()     register_shape(name, hand_form) def clockface(radius):     reset()     pensize(7)     for i in range(60):         jump(radius)         if i % 5 == 0:           ...

Program to check whether the given number is prime or not

#include<stdio.h> #include<conio.h> void main() {   int n, i, count=0;   clrscr();   printf("\nEnter a number: ");   scanf("%d",&n);   for(i=2;i<=n/2;i++)   {     if(n%i==0)     {       count++;       break;     }   }   if(count==0)   {      printf("%d is a prime number",n);   }   else   {      printf("%d is not a prime number",n);   }   getch(); } OUTPUT: Enter a number: 11 11 is a prime number Enter a number: 25 25 is not a prime number

Inserting,Deleting and Updating table values in Database using Python Programming

Insert,Delete and Update import tkinter as tk from tkinter import * import mysql.connector import datetime def IsValidDate(InputDate):     day = InputDate[:2]     month = InputDate[3:5]     year = InputDate[6:]         IsValid = True         try :         datetime.datetime(int(year),int(month),int(day))     except ValueError :         IsValid = False     return IsValid def FormatDBDate(InputDate):     dt = InputDate[6:] + "-" + InputDate[3:5] + "-" + InputDate[:2]     return dt    def FormatEDDate(InputDate):     dt =  InputDate[8:] + "/" + InputDate[5:7] + "/" + InputDate[:4]     return dt  def DeleteEmployee(id, eid, ename, dob, doj, adr, cty, pcd, mob, eml, gen, dep):     conn=mysql.connector.connect(user='root',password='harsha',host='localhost', datab...