Skip to main content

Posts

Showing posts with the label c

Fibonacci series

Fibonacci series are series of numbers that start with 1 and 1, and then each subsequent number is the sum of the previous two. For example, 1, 1, 2, 3, 5, 8, 13, ... are Fibonacci series. These series have many applications and properties in mathematics, nature, art and computer science. In this blog post, I will show you how to write a C program that prints the Fibonacci series up to a given number. The program will use a recursive function that calls itself with a smaller argument until it reaches the base case of zero or one. Then it will return the Fibonacci number for that argument and print it on the screen. The source code for the program is: #include <stdio.h> int fibo (int n){     // base case: return 1 if n is zero or one     if (n == 0 || n == 1){         return 1;     }     // recursive case: return the sum of fibo(n-1) and fibo(n-2)     else{         int result = fibo(n-1) + fib...

hello world in c language

Here about the C programming Language.There are few Questions and about hello world programming c program. All the programmers start their programs using hello world  #include < stdio.h > int main{ printf("hello world") } The  1st line of c program we usually import the c standard libraries. The #include is to indicate that the program should include a library. <stdio.h> is a standard library in C language. Printf() is a function that is included in the standard library  "Hello word" is a string. String must be in double quotes. Braces{ } indicates the blocks in the c program. Block is  declared after the function. Questions on C programming Langugae Here are few Questions hard C programming Question: 1Q)   Explain the difference between static and dynamic memory allocation in C? Ans :  Static vs. Dynamic Memory Allocation in C Feature Static Memory Allocation Dynamic Memory Allocation Allocation time During compile time During runtime Mem...