Thursday, 5 June 2014
0
Thursday, 5 June 2014
IndianBooktuber
read more
C Program 16: To Print The Fibonacci Series Using Recursion

Aim: To print fibonacci series
Fibonacci series is the one in which every third number is the sum of first two.
The series is 1,1,3,4,7,11,18....
//To print the fibonacci series using recursion
#include<stdio.h>
#include<conio.h>
int fibo(int x);
void main()
{
int a=1, b=1, n,p;
printf("Enter...
0
IndianBooktuber
read more
C Program 15: To Find the Factorial of a number using for loop

Aim: To find factorial of a number
Factorial of a number like 4 would be 4*3*2*1=24
Following would be the code:
// To find the factorial of a given number using for loop
#include<stdio.h>
#include<conio.h>
void main()
{
int fact, a;
printf("Enter the number: ");
scanf("%d",...
0
IndianBooktuber
read more
C Program 14: To Find The Factorial of a Number Using Recursion

Aim: To find the factorial using recursion.
What is Recursion? when a function calls itself, the phenomenon is referred to as recursion and it is one of the most powerful features of C. Most of the algorithms that are developed using C use recursion.
Code:
// To find the factorial of a given number using recursion
#include<stdio.h>
#include<conio.h>
void...
Tuesday, 3 June 2014
0
Tuesday, 3 June 2014
IndianBooktuber
read more
C Program 13: To Swap Two Numbers Using Pointers

Aim: Swap two numbers using pointers.
Following is the code:
//To swap two numbers using pointers
#include<stdio.h>
#include<conio.h>
void swap(int *a, int *b)
{
int temp;
temp = *a;
*a=*b;
*b=temp;
// printf ("The value of a is: %d...
0
IndianBooktuber
read more
C Program 12: To Print The Given Rectangle Pattern

Aim: To print this pattern
*-***********
***-*********
*****-*******
*******-*****
*********-***
***********-*
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int i, j, k;
for (i=0; i<=5; i++)
{
...
Monday, 2 June 2014
0
Monday, 2 June 2014
IndianBooktuber
read more
C Program 11: To Print a Right Angled Triangle

Aim: To print this pattern
*
**
***
****
*****
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int i, j, n;
printf("Click on number of lines you want to print: ");
scanf("%d", &n);
for (i=1; i<=n; i++)
{
...
0
IndianBooktuber
read more
C Program 10: To Find The Smallest Number in an Array

Aim: To Find the smallest number in an array
Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int i, arr[5], smallest;
printf("Enter the values in an array: ");
for (i=0; i<=5; i++) /* enter values into array */
{
...
Subscribe to:
Posts (Atom)