Ads 468x60px

Labels

Featured Posts

Jun 10, 2012

#2 - Printing A Star Sequence [Java]

class star
{
public static void main(String args[])
{
int i,j;
for(i=0;i<5;i++)
{
for(j=0;j<=i;j++)
{
System.out.print("*");
}
System.out.println("");
}
}
}

Jun 9, 2012

#10 - Printing A Star Sequence [C]

#include<stdio.h>
#include<conio.h>

void main()
{
int i,j;
for(i=0;i<5;i++)
{
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
}

Jun 7, 2012

#9 - Factorial Of A Number [C]

#include"stdio.h"
void main()
{
int i,n,fact=1;
clrscr();
printf("Enter the number \n");
scanf("%d",&n);
for(i=1; i<=n; i++)
fact = fact*i;
printf("Factorial of %d is %d\n",n,fact);
getch();
}

#8 - Palindrome (Compare Two Strings) - [C]

#include"stdio.h"
#include"string.h"
void main()
{
char s1[20], s2[20];
clrscr();
printf("\n Enter the string \n");
scanf("%s",&s1);
strcpy(s2,s1);
strrev(s1);
if(strcmp(s2,s1))
printf("\n The string %s is not palindrome",s2);
else
printf("\n The string %s is palindrome",s2);
getch();
}

#7 - Number Of Vowels [C]

#include"stdio.h"
#include"string.h"
void main()
{
int count=0,x,a,e,i,o,u;
char name[25];
clrscr();
printf("\n Enter the name \n");
scanf("%s",&name);
x=strlen(name);
printf("Your name contain %d characters \n",x);
for(i=0;i