Introduction To Programming

Why programs ? Programming is nothing but making the computers think the same way a human thinks. Programs are made for obtaining a specific solution which can even be solved by humans which when solved by us may consume time..

Thursday, September 24, 2009

Prime Numbers

PRIME NUMBER:
a numbers which can only divide perfecly by same number is called as Prime numbers(1 is prime no.)and also it can be divide by the 1(because 1 divide all no.).

Floyd's Triangle

This program will design the floyd's triangle

Perfect No

here is the program check whether no. is perfect no. or not. If additon of all smaller no.s that divide the target_no perfectly also smaller than target_no is equal to target_no, then target_no is called as perfect no. i.e

Eg: take no. 6(target_no)
what're smaller no. of 6?
1,2,3,4,5
which no.s divide the 6 perfectly?
1,2,3
Addition of dividing no.s:
1+2+3=6(result)
now result=target_no ,so 6 is target no.
Here is the simple program to check whether the target is perfect or not.

Bit Count C Program

void main()
{
int x,b,c;
clrscr();
x=10;
for(c=0;x!=0;x=x>>1)
{
if(x&01)
++c;
}
printf("%d",c);
getch();
}