Sunday, December 1, 2013


IT IS THE LITTLE THINGS THAT MAKE A BIG DIFFERENCE


There was a man taking a morning walk at or the beach. He saw that along with the morning tide came hundreds of starfish and when the tide receded, they were left behind and with the morning sun rays, they would die. The tide was fresh and the starfish were alive. The man took a few steps, picked one and threw it into the water. He did that repeatedly. Right behind him there was another person who couldn't understand what this man was doing. He caught up with him and asked, "What are you doing? There are hundreds of starfish. How many can you help? What difference does it make?" This man did not reply, took two more steps, picked up another one, threw it into the water, and said, "It makes a difference to this one."

What difference are we making? Big or small, it does not matter. If everyone made a small difference, we'd end up with a big difference, wouldn't we?

Friday, November 29, 2013





/* C program to find LCM of two positive integers entered by user */ 
#include<stdio.h> 
int main() 

int n1,n2,temp1,temp2; 
printf("Enter two positive integers: "); 
scanf("%d %d",&n1,&n2);
 temp1=n1;
 temp2=n2;
   while(temp1!=temp2)
    { 
      if(temp1>temp2)
         temp1-=temp2; 
      else 
        temp2-=temp1;
    }
 printf("LCM of two numbers %d and %d is %d", n1, n2, (n1*n2)/temp1);
return 0;
}

Output:
Enter two positive numbers: 15 9 
LCM of two numbers 15 and 9 is 45
/* C Program to Find Highest Common Factor. */
#include<stdio.h>
int main() 

int num1,num2; 
printf("Enter two integers: "); 
scanf("%d %d",&num1,&num2); 
printf("HCF of %d and %d is ",num1 , num2); 
 while(num1!=num2) 
   { 
     if(num1>num2) 
       num1-=num2; 
     else num2-=num1; 
   } 
 printf("%d",num1); 
return 0; 
}

Output:
Enter two integers: 
14 35 
HCF of 14 and 35 is 7
/* C program to check whether a year is leap year or not using if else statement.*/ 
#include<stdio.h>
int main()

int year;
printf("Enter a year: "); 
scanf("%d",&year); 
if(year%4 == 0) 
  { 
    if( year%100 == 0) /* Checking for a century year */ 
      { 
        if ( year%400 == 0) 
          printf("%d is a leap year.", year); 
        else 
          printf("%d is not a leap year.", year); 
      } 
   else 
     printf("%d is a leap year.", year ); 
  } 
else 
 printf("%d is not a leap year.", year);
return 0; 
}

Output 1:
Enter year: 2000 
2000 is a leap year.
Output 2:
Enter year: 1900
1900 is not a leap year.

/* C program to find largest number using if...else statement */ 
#include<stdio.h>
int main()

float a, b, c; 
printf("Enter three numbers: "); 
scanf("%f %f %f", &a, &b, &c); 
if (a>=b) 

  if(a>=c) 
   printf("Largest number = %.2f",a); 
  else 
   printf("Largest number = %.2f",c); 

else 

  if(b>=c) 
   printf("Largest number = %.2f",b); 
 else 
   printf("Largest number = %.2f",c); 

return 0; 
}

Output:
Enter three numbers: 
12.2 
13.452 
10.193 
Largest number = 13.45
/* Source code to find ASCII value of a character entered by user */ 
#include<stdio.h>
int main()

char c; 
printf("Enter a character: "); 
scanf("%c",&c); /* Takes a character from user */ 
printf("ASCII value of %c = %d",c,c); 
return 0; 

----------------------------------------------------------------------------------------
/* This program computes the size of variable using sizeof operator.*/ 
#include<stdio.h>
int main()

int a; 
float b; 
double c; 
char d; 
printf("Size of int: %d bytes\n",sizeof(a)); 
printf("Size of float: %d bytes\n",sizeof(b)); 
printf("Size of double: %d bytes\n",sizeof(c)); 
printf("Size of char: %d byte\n",sizeof(d)); 
return 0; 


Output:
Size of int: 4 bytes 
Size of float: 4 bytes 
Size of double: 8 bytes 
Size of char: 1 byte