ALT_IMG

You are the cause of my pain

You are the cause of my pain, yet the love I feel for you is my only consolation, my only cure..

ALT_IMG

Saw the girl, whom once I thought as my best friend

Remembering my classmates, after few years, My eyes were filled with tears, Everyone is busy a lot, No one escaped destiny's plot, Saw the girl, whom once I thought as my best friend, Today she is some body else's girl friend, After months remembered about her for a little while, Heard she is happy, that made me smile.

Alt img

It’s been raining since you left me

It’s been raining since you left me, now I’m drowning in the flood. You see, I’ve always been a fighter, but without you I give up.

ALT_IMG

Sweet Heart

Sweetheart.....I miss ......THe whisper of your voice...The warmth of your touch and all the wonderful times that we shared together.......

ALT_IMG

When I see you

When I see you smile and know that it's not for me, that's when I miss you the most.

Tuesday, June 28, 2011

C PROGRAM TO REVERSE A NUMBER USING WHILE LOOP

2 comments
/*Program to reverse a number using while loop*/
#include<stdio.h>
void main()
{
long int number,reverse,n;
clrscr();
printf("Enter the number");
scanf("%ld",&number);
reverse=0;
while(number!=0)
{
n=number%10;
reverse=reverse*10+n;
number=number/10;
}
printf("The reverse number=%ld\n",reverse);
getch();
}
Continue reading →

TO FIND THE SUM OF DIGITS IN A FIVE DIGIT NUMBER

0 comments
#include<stdio.h>
void main()
{
int digit_1,digit_2,digit_3,digit_4,digit_5,sum,number,n;
printf("Enter a five digit number");
scanf("%d",&number);
n=number;
digit_1=n%10;
n=n/10;
digit_2=n%10;
n=n/10;
digit_3=n%10;
n=n/10;
digit_4=n%10;
n=n/10;
digit_5=n;
sum=digit_1+digit_2+digit_3+digit_4+digit_5;
printf("sum of digits=%d\n",sum);
getch();
}

Continue reading →
Monday, June 27, 2011

How Use Loops in C-'DO WHILE' Loops

0 comments



'DO WHILE' loops are useful for things that want to loop at least once.The syntax is:
do
{
Code to execute
}while(condition);

Example:
#include<stdio.h>
int main()
{
int x;
x=0;
do
{/*"Hello World!" is printed at least one time even though the condition is false*/
printf("Hello World!");
}
while(x!=0);
getchar();
}
Notice that the condition is tested at the end of the block instead of beginning ,so the block will be executed at least once.If the condition is true,we jump back to the beginning of the block and execute it again.A DO WHILE loop is almost  the same as WHILE loop except that the loop body is guaranteed to execute at least once.A WHILE loop says"Loop while the condition is true,and execute this block of code".A DO WHILE loop says"execute this block of code,and then continue to loop while the condition is true". Notice that this loop will execute once,because it automatically execute before checking the condition.


<<Prev Home Next>>
Continue reading →