Showing posts with label loop. Show all posts
Showing posts with label loop. Show all posts

Thursday, 15 November 2012

C program to find whether a given number is an Armstrong number or not


C program to find whether a given number is an Armstrong number or not

#include<stdio.h>
#include<conio.h>
#include<math.h>

Wednesday, 14 November 2012

C program to reverse any number

C program to reverse any number

#include<stdio.h>
#include<conio.h>

Monday, 16 July 2012

C program to find largest number of a list of numbers entered through keyboard


C program to find largest number of a list of numbers entered through keyboard


#include<stdio.h>
#include<conio.h>


void main()
{
int i,n,x,large=0;
clrscr(); //to clear the screen

Saturday, 14 July 2012

C program to print the truth table for XY+Z


C program to print the truth table for XY+Z


#include<stdio.h>
#include<conio.h>


void main()
{
int x,y,z;
clrscr(); //to clear the screen
printf("X\tY\tZ\tXY+Z");

Friday, 29 June 2012

C program to find average of list of numbers entered through keyboard


#include<stdio.h>
#include<conio.h>


void main()
{
int i,n,sum=0,e;
float avg;
clrscr(); //to clear the screen

Wednesday, 23 May 2012

C program to print fibonacci series i.e., 0 1 1 2 3 5 8.....


#include<stdio.h>
#include<conio.h>


void main()
{
int first=0,second=1,third,i,n;
clrscr();  //to clear the screen

Tuesday, 22 May 2012

C program to print table of a given number




#include<stdio.h>
#include<conio.h>


void main()
{
int i,n;
clrscr(); //to clear the screen

C program to generate divisors of an integer



#include<stdio.h>
#include<conio.h>


void main()
{
int i,n;
clrscr();  //to clear the screen

Monday, 21 May 2012

C program to check whether the given number is palindrome or not



#include<stdio.h>
#include<conio.h>


void main()
{
int n,a,b=0,num;
clrscr(); //to clear the screen
printf("Enter any number:");
scanf("%d",&n);
num=n;

C program to check whether a number is prime or not


#include<stdio.h>
#include<conio.h>


void main()
{
int n,i,flag=1;
clrscr(); //to clear the screen
printf("Enter any number:");
scanf("%d",&n);

Sunday, 20 May 2012

C program to calculate the factorial of an integer


#include<stdio.h>
#include<conio.h>


void main()
{
long i,n,fac=1;
clrscr(); //to clear the screen

Friday, 18 May 2012

C program to print first n natural numbers and their sum


#include<stdio.h>
#include<conio.h>


void main()
{
int n,i,sum=0;
clrscr(); //to clear the screen
printf("Enter the value of n:");
scanf("%d",&n);

C program to print numbers from 1 to 10 using for loop



#include<stdio.h>
#include<conio.h>


void main()
{
int i;
clrscr(); //to clear the screen