Monday, November 30, 2009

C Program to print integers using nested for loop

#include
#include
void main()
{
int i,j;
clrscr();
for(i=1;1<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d\t",j);
}
printf("\n");
}
getch();
}

Sunday, November 29, 2009

C Program to print n integers using for loop

#include
#include
void main()
int i,n;
printf("enter limit");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("%d",i);
}
getch();
}

Friday, November 27, 2009

C Program to print all the divisors of any integer n using for loop

#include
#include
void main()
{
int n,i;
printf("Enter any no.");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if((n%i)==0)
{
printf("i=%d,",i);
}
}
getch();
}

Wednesday, November 25, 2009

C Program to find sum of 10-100 numbers that are divisble by 7 using for loop

#include
#include
void main()
{

int n,sum=0;
clrscr();
for(n=10;n<=100;n++)
{
if((n%7)==0)
{
sum=sum+n;

}
}
printf("sum=%d",sum);
getch();
}

Sunday, November 22, 2009

C Program using switch statement

#include
#include
void main()
{
int a;
clrscr();
printf("Enter any no. between 1&3");
scanf("%d",&a);
switch(a)
{
case 1:printf("One");
break;
case 2:printf("Two");
break;
case 3:printf("Three");
break;
default:printf("Invalid case");
}
getch();
}

Thursday, November 19, 2009

C Program to find sum of 5 digits of a number using while loop

#include
#include
void main()
{
int n,i,a,sum=0;
printf("enter 5 digit no.");
scanf("%d",&n);
while(n<=5)
{
a=n%10;
n=n/10;
}
sum=sum+a;
printf("sum=%d",sum);
getch();
}

Wednesday, November 18, 2009

C Program to print days of week using switch statement

#include
#include
void main()
{
char a;
clrscr();
printf("Enter any first character of day");
scanf("%c",&a);
switch(a)
{
case 'S':printf("Sunday");
break;
case 'm':printf("Monday");
break;
case 't':printf("Tuesday");
break;
case 'w':printf("Wednesday");
break;
case 'T':printf("Thursday");
break;
case 'f':printf("Friday");
break;
case 's':printf("Saturday");
break;
default :printf("Invalid case");
}
getch();
}

Tuesday, November 17, 2009

C Program using if,else

#include
#include
void main()
{
int x,y;
printf("enter value of x");
scanf("%d",&x);
if(x>0)
{
printf("The value of y is 2");
}
else if(x==0)
{
printf("value of y is 0");
}
else
{
printf("value of y is -2");
}
printf("value of y is %d",y);
}

Monday, November 16, 2009

C Programs to calculate discount on items on the basis of amount of the item using if-else ladder

#include
#include
void main()
{
float amt,dis;
printf("enter amount of an item");
scanf("%f",&amt);
if(amt>=10000)
{
printf("discount is 30%");
dis=(amt*30.0)/100;
}
else if ((amt>=7000)&&(amt<10000))
{
printf("discount is 20%");
dis=(20.0*amt)/100;
}
else if((amt>=5000)&&(amt<7000))
[
printf("discount is 15%");
dis=(amt*15.0)/100;
}
else if((amt>=2000)&&(amt<5000))
{
printf("discount is 10%");
dis=(amt*10.0)/100;
}
else
{
printf("discount is 5%");
dis=(amt*5.0)/100;
}
printf("discount=%f",dis);
}

Sunday, November 15, 2009

C Program to determine whether the angle is Right Angle or Acute Angle

#include
#include
void main()
{
int a;
printf("/n enter value of a");
scanf("%d",&a);
if(a>180)
{
printf("Not valid");
}
else if(a==180)
{
printf("Straight line");
}
else if((a>=90)&&(a<180))
{
printf("Right angle triangle");
}
else
{
printf("acute angle");
}
getch();
}

Saturday, November 14, 2009

C Program to determine whether the character is Capital letter or Sma;; Case Letter or Special character

#include
#include
#include"<"ctype.h">"
void main()
{
int val;
char ch;
printf("/n Enter any character");
scanf("%c",&ch);
val=toascii(ch);
if((val>=65)&&(val=90))
{
printf("/n Capital letters");
}
else if((val>=97)&&(val<=122))
{
printf("/n Small case letters");
}
else if((val>=48)&&(val<=57))
{
printf("/n digits");
}
else
{
printf("/n Special symbols");
}
getch();
}

Friday, November 13, 2009

C Program to calculate tax for male and female using if-else condition

#include
#include
void main()
{
char g,m,f;
float bs,tax;
printf("enter gender");
scanf("%c",&g);
printf("enter basic salary");
scanf("%f",&bs);
if(g==m)
{
if(g==f)
{
printf("gender is female");
tax=(40.0*bs)/100.0;
}
else
{
printf("gender is male");
tax=(20.0*bs)/100.0;
}
}
printf("tax=%f",tax);
}

Wednesday, November 11, 2009

C Program to shows the use of arithemetic operator,Logical operator,increment operator

#include
#include
void main()
{
int a,b,c,d,sum,result,inc;
printf("enter values of a,b,c,d");
scanf("%d,%d,%d,%d",&a,&b,&c,&d);
sum=a+b;
printf("sum=%d",sum);
if((a>b)&&(c>d))
{
printf("true");
}
else
{
printf("false");
}
result=(a>b)?(a-b):(a+b);
printf("result=%d",result);
inc=a++;
printf("the increment value=%d",inc);
}

C Program to determine whether a entered character is vowel or constant

#include
#include
void main()
char ch;
printf("enter any character");
scanf("%s",&ch);
if(ch==a||ch==e||ch==i||ch==o||ch==u)
{
printf("character is vowel");
}
else
{
printf("character is consotant");
}
getch();
}

Monday, November 9, 2009

C Program to calculate sum of reverse of 5 digits

#include
#include
void main()
{
int a,b,c,d,e,rev,n;
printf("enter a 5 digit no.");
scanf("%d",&n);
rev=0;
a=n%10;
rev=(rev*10)+a;
n=n/10;
b=n%10;
rev=(rev*10)+b;
n=n/10;
c=n%10;
rev=(rev*10)+c;
n=n/10;
d=n%10;
rev=(rev*10)+d;
n=n/10;
e=n%10;
rev=(rev*10)+e;
printf("the reverse value=%d",rev);
getch();
}

Sunday, November 8, 2009

C Program to calculate sum of 3 subjects nd check wheter it is Eligible or Not Eligible

#include
#include
void main()
{
int math,chem,phy,s1,s2;
printf("enter marks in maths,phy,chem");
scanf("%d,%d,%d",&math,&phy,&chem);
s1=math+phy+chem;
s2=math+phy;
if((math>=60)&&(phy>=50)&&(chem>=40))
{
printf("Eligible");
}
else if(s1>=200)
{
printf("Eligible");
}
else if(s2>=150)
{
printf("Eligible");
}
else
{
printf("Not Eligible");
}
getch();
}

Saturday, November 7, 2009

C Program to convert seconds into hours ,minutes and seconds

#include
#include
void main()
{
int sec,hrs,min,t;
printf("enter time in seconds");
scanf("%d",&sec);
hrs=sec/3600;
t=sec%3600;
min=t/60;
sec=t%60;
printf("time in hrs=%d,min=%d,sec=%d",hrs,min,sec);
getch();
}

Friday, November 6, 2009

C Program to addition of 5 digits

#include
#include
void main()
{
int a,b,c,d,e,n,sum;
printf("the value of n is");
scanf("%d",&n);
n=n;
a=n%10;
b=n%10;
c=n%10;
d=n%10;
e=n%10;
sum=0;
sum=sum+a+b+c+d+e;
printf("the sum is %d",sum);
getch();
}

Thursday, November 5, 2009

C Program to swap 3 numbers

#include
#include
void main()
{
int a,b,c;
printf("the value of a,b");
scanf("%d,%d",&a,&b);
c=a;
a=b;
b=c;
printf("the value a=%d",a);
printf("the value b=%d",b);
getch();
}

Wednesday, November 4, 2009

C Program to calculate sum of 5 numbers

#include
#include
void main()
{
int a,b,c,d,e,n,sum;
printf("the value of n is");
scanf("%d",&n);
n=n;
a=n%10;
b=n%10;
c=n%10;
d=n%10;
e=n%10;
sum=0;
sum=sum+a+b+c+d+e;
printf("the sum is %d",sum);
getch();
}

Tuesday, November 3, 2009

C Program to Calculate Area of Triangle

#include
#include
#include
void main()
{
int a,b,c,s,ar;
printf("enter the value of a,b,c");
scanf("%d,%d,%d",&a,&b,&c);
s=(a+b+c)/2;
ar=sqrt(s*(s-a)*s*(s-b)*s*(s-c));
printf("the area of triangle=%d",ar);
getch();
}

Monday, November 2, 2009

Figures & captions

Eiffel tower

Scale model of the Eiffel tower in Parc Mini-France


HTML doesn't have an element that allows to insert a figure with a caption. It was once proposed (see HTML3), but never made it into HTML4. Here is one way to simulate such a figure element:


height="200" alt="Eiffel tower" />

Scale model of the
Eiffel tower in Parc Mini-France

Then in the style sheet you use the class "figure" to format the figure the way you want. For example, to float the figure to the right, in a space equal to 25% of the width of the surrounding paragraphs, these rules will do the trick:

div.figure {
float: right;
width: 25%;
border: thin silver solid;
margin: 0.5em;
padding: 0.5em;
}
div.figure p {
text-align: center;
font-style: italic;
font-size: smaller;
text-indent: 0;
}

In fact, only the first two declarations (float and width) are essential, the rest is just for decoration.

Sunday, November 1, 2009

Windows Keyboard Shortcuts for Mozilla Firefox

CTRL + A Select all text on a webpage
CTRL + B Open the Bookmarks sidebar
CTRL + C Copy the selected text to the Windows clipboard
CTRL + D Bookmark the current webpage
CTRL + F Find text within the current webpage
CTRL + G Find more text within the same webpage
CTRL + H Opens the webpage History sidebar
CTRL + I Open the Bookmarks sidebar
CTRL + J Opens the Download Dialogue Box
CTRL + K Places the cursor in the Web Search box ready to type your search
CTRL + L Places the cursor into the URL box ready to type a website address
CTRL + M Opens your mail program (if you have one) to create a new email message
CTRL + N Opens a new Firefox window
CTRL + O Open a local file
CTRL + P Print the current webpage
CTRL + R Reloads the current webpage
CTRL + S Save the current webpage on your PC
CTRL + T Opens a new Firefox Tab
CTRL + U View the page source of the current webpage
CTRL + V Paste the contents of the Windows clipboard
CTRL + W Closes the current Firefox Tab or Window (if more than one tab is open)
CTRL + X Cut the selected text
CTRL + Z Undo the last action