Wednesday 16 April 2014

Program to Check Whether a Given String is Palindrome or Not

/* Write an Interactive C Program to Check Whether a Given String is Palindrome or Not, Using Pointer*/
main()
{
 char ch[20],a[20],*p;
 int i,len,c=0;
 clrscr();

Program to Replace a Character in a String.

/*Write a function strreplace(s,chr,repl_chr) which will replace each occurrences of character chr with the character repl_chr in the string s. The function returns the number of replacements.*/

int strreplace(char [],char,char);
main()
{
 char s[160],c,r;
 int i;
 clrscr();
 printf("Enter any string \(word or sentence\).\n");

Program to Convert a Binary Number to Its Octal Equivalent.

main()
{
 int bin[16],i,oct[16],s,os,j,x,r;
 clrscr();
 printf("Enter the number of bits you want to insert. --> ");

Saturday 29 March 2014

Program To Calculate and Report the Owed Income Tax Amount

/* Assume that the United States of America uses the following income tax code formula for their annual income:
First US$ 5,000 of income: 0% tax
Next US$ 10,000 of income: 10% tax
Next US$ 20,000 of income: 15% tax
Next  Amount upto and above US$ 35,000: 20% tax.
For example, somebody earning US$ 38,000 annually would owe

Program To Check Whether Given Two Numbers Are Amicable Numbers or Not

/*Amicable Numbers are two numbers so related that the sum of the proper divisors of the one is equal to the other, unity being considered as a proper divisor but not the number itself. Such a pair is (220, 284).*/