/* C program to generate and print Fibonacci series */ #include<stdio.h> main() { int n,i,a=0,b=1,c=0; printf(“Enter Nth term of Fibonacci series : “); scanf(“%d”,&n); printf(“\n %d %d “,a,b); //for printing first two numbers for(i=2;i<n;i++) // for printing from 3rd number in series { c=a+b; a=b; b=c; printf(“%d “,c); } printf(“\n\n”);… Continue Reading C program to print Fibonacci series upto N th term

/* C Program to Swap Two Numbers using Temp/Third Variable */ #include <stdio.h> main() { int a, b, temp; printf(“\n Enter the values of a and b: “); scanf(“%d %d”, &a, &b); // Taking The values of x and y from user printf(“\n Before Swapping: \n a = %d b… Continue Reading C Program to Swap Two Numbers using Temp/Third Variable

/* C program to add n integers using array */ #include <stdio.h> int main() { int n,i,value[100]; //declaring value as array whose length is 100 int sum=0; // declaring sum to zero , otherwise it stores garbage values printf(“\n Enter the number of integers you want to add: “); scanf(“%d”,… Continue Reading C Program to Add N integers using Array

/* c program to add n integers without using array */ #include <stdio.h> int main() { int n,i,value; int sum=0; // declaring sum to zero , otherwise it stores garbage values printf(“\n Enter the number of integers you want to add: “); scanf(“%d”, &n); printf(“\n Enter %d integers: “,n); for… Continue Reading C Program to Add n Integers without Array

C Program To Find the Size of Data Types using sizeof operator #include<stdio.h> void main() { printf(“\n size of int is: %d”,sizeof(int)); printf(“\n size of float is: %d”,sizeof(float)); printf(“\n size of double is: %d”,sizeof(double)); printf(“\n size of char is: %d”,sizeof(char)); } Program can also be written using sizeof operator with… Continue Reading C Program example for sizeof operator

* C program for showing format specifiers in c * #include<stdio.h> main() { printf(“\n This is a integer Number1: %d”,123); printf(“\n This is a integer Number2: %06d”,25); //convert it to 6 digit number printf(“\n This is a integer Number3: %i”,123); printf(“\n This is a Float value: %f”,3.14); printf(“\n This is… Continue Reading C program for showing printf Format Spcifiers in c

C program to find the Largest of Three Numbers using Conditional Operator. PROGRAM: #include<stdio.h> int main() {   int a,b,c,large;   printf(“\n Enter Three Numbers:”);   scanf(“%d %d %d”, &a , &b , &c);   large = (a > b && a > c ? a : b > c… Continue Reading C program to find the Largest of Three Numbers using Conditional Operator

C Program to understand the usage of Bitwise Operator & . (Or) Example c program for Bitwise operator & . PROGRAM: #include<stdio.h> #include<conio.h> main() { int n,i; printf(“\n Enter a Integer Number to find Even or Odd:”); scanf(“%d”,&n); i=!(n&1);  // & is a bitwise and operator if ((i)) printf(“\n The… Continue Reading C Program to find Number Even or Odd using Bitwise AND ( & ) Operator

C Program to find whether the given number is even or odd. PROGRAM : #include <stdio.h> void main() { int num; printf(“Enter a number to find Even or Odd: \n”); scanf(“%d”,&num); //taking input from user if (num%2==0) //checking whether the remainder is zero when divided by 2 printf(” The number… Continue Reading c program to find the number even or odd

C Program to understand the Arithmetic Operators And their Precedence. PROGRAM: #include<stdio.h> void main() { int a=25,b=5,c=10,d=4; int result; result = a+b; //adding a and b printf(“\n Addition Result: %d”,result); result = a-b; //subtracting b from a printf(“\n Subtraction Result is: %d”,result); result = a*b; //multiplying a and b printf(“\n… Continue Reading C Program to Show the Operations of Arithmetic Operators

C Program for understanding the concept of Pre-decrement and Post-decrement   #include<stdio.h> main() { int i=10,j; j = i–; //j value 10 , i value 11 //post decrement printf(“\n After post-decrement: j value: %d , i value:%d \n”,j,i); j = –i; //j value 12, i value 12 //pre-decrement printf(“\n After… Continue Reading C Program for pre decrement and post decrement

C Program for understanding the concept of pre-increment and post-increment PROGRAM: #include<stdio.h> main() { int i=10,j; j = i++; // j value 10 , i value 11 //post increment printf(“\n After post-increment: j value: %d , i value: %d \n”,j,i); j = ++i; // j value 12, i value 12… Continue Reading C Program for pre-increment and post-increment

C Program for explaining the division operation, for getting quotient and remainder. PROGRAM: #include<stdio.h> #include<conio.h> int main() { int x,y; int result1,result2; printf(“\n Enter the dividend : “); scanf(“%d”,&x); printf(“\n Enter the divisor: “); scanf(“%d”,&y); result1 = x/y; //it gives the quotient result2 = x%y; //it gives remainder printf(“\n The… Continue Reading C Program for Division

C Program to calculate the product of two numbers : PROGRAM: #include<stdio.h> int main() { int x,y; int result; printf(“\n Enter the first number : “); scanf(“%d”,&x); //reading 1st number from user printf(“\n Enter the second number: “); scanf(“%d”,&y); // reading 2nd number from user result = x * y;… Continue Reading C Program to get the product of two numbers

C Program to add two numbers / Integers using Pointers : PROGRAM: #include<stdio.h> #include<conio.h> main() { int num1,num2, *p, *q, sum; // *p,*q are integer pointer variables printf(“\n Enter two integers to add: “); scanf(“%d %d”, &num1, &num2); p = &num1; // &num1 gives the value at address of num1… Continue Reading C Program to add two Numbers / Integers using Pointers

Simple C Program for adding two numbers : PROGRAM: #include<stdio.h> int main() { int x; int y; int result; printf(“\n Enter the first number to be added: “); scanf(“%d”,&x); printf(“\n Enter the second number to be added: “); scanf(“%d”,&y); result = x + y; printf(“\n The sum of two numbers… Continue Reading C Program for adding two Numbers / Integers