Inversing of a given Number. suppose we gave input 123456 then the output of the program will be 654321.
Archive for September, 2010
C program to Print Inverse of a given Number
September 30, 2010c program for to find Prime Number
September 30, 2010c program for Fibonacci Series
September 27, 2010C program to print number’s till limit, Except those that are divisible by 8
September 22, 2010//To print no. till limit, except those that are divisible by 8
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
clrscr();
printf(“Ener a limit”);
scanf(“%d”,&n);
for(i=1;i<=n;i++)
if(i%8!=0)
printf(“\n%d”,i);
else
continue;
getch();
}
Hope you liked my posts, give comments if you have any doubts…:)
c program for Enter values to continuous loop. If value =0 then break & print sum & average.
September 22, 2010To print pyramid output
September 19, 2010To Print Output like
*
**
***
****
*****
****** (more…)
c program to prepare Table of any Number using while & for loop
September 10, 2010using while loop
//Program to prepare Table of any no. using while loop
#include
#include
void main()
{
int n,t,count=1;
clrscr();
printf(“Enter any number\n\n”);
scanf(“%d”,&n);
while(count<=10)
{
t=n*count;
printf(“\n%d*%d=%d”,n,count,t);
count++;
}
getch();
}
Factorial Program
September 5, 2010In mathematics, the factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n.
For example, 5 ! = 5 * 4* 3 * 2* 1 = 120
Using While Loop
type 1:
//Program for Factorial
#include<stdio.h>
#include<conio.h>
void main()
{
int n,fact=1;
clrscr();
printf(“Enter any Number:\n\n”);
scanf(“%d”,&n);
while(n>1)
{
fact=fact*n;
n–;
}
printf(“\nFactorial is=%d”,fact);
getch();
}
c program for Calculate Simple Interest for 3 sets of p, n & r using while & for loop
September 4, 2010using while loop
/*Calculate Simple Interest for 3 sets of p, n & r
p, n & r represent principle, no. of years & rate of interest*/
#include<stdio.h>
#include<conio.h>
void main()
{
int p,n,count=1;
float r,si;
clrscr();
while(count<=3)
{
printf(“Enter value for p,n & r\n\n”);
scanf(“%d%d%f”,&p,&n,&r);
si=(p*n*r)/100;
printf(“\nSimple Interest =%f”,si);
count++;
}
getch();
}
Program to find out Maximum of 3 number’s using Conditional Operator
September 4, 2010//Program to find out Maximum of 3 number’s using Conditional Operator
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf(“Enter 3 nos:\n \n”);
scanf(“%d%d%d”,&a,&b,&c);
(a>b)?((a>c)?printf(“a is max”):printf(“c is max”)):((b>c)?printf(“b is max”):printf(“c is max”));
getch();
}
Hope you liked my posts, give comments if you have any doubts…:)