Monthly Archives: September 2008

Program to compute sin(x) through series summation

#define PI 3.14#include <stdio.h>#include <math.h>main(){ /*Program to compute sin(x) through series summation*/ float x=0, sum=0, term=0; int sign=1, den=1; printf("\nEnter the angle in degrees: "); scanf("%f", &x); x=(PI/180)*x; term = x; while(fabs(term) >= 0.000001) {  sum = sum + (term*sign);  term = (term*x*x)/((den+1)*(den+2));  sign = sign*(-1);  den = den + 2; } printf("\nThrough series summation   … Continue reading

Posted in Information Technology | Leave a comment

Program to determine the product of two matrices

#include <stdio.h>main(){ /*Program to determine the product of two matrices*/ int m=0, n=0, p=0, A[100][100], B[100][100], C[100][100], i=0, j=0, k=0, temp=0; printf("\nEnter number of rows for matrix A: "); scanf("%d", &m); printf("\nEnter number of columns for matrix A: "); scanf("%d", &n); printf("\nEnter number of columns for matrix … Continue reading

Posted in Information Technology | Leave a comment

Program to read a number and print it out digit by digit as a series of words

#include <stdio.h>#include <string.h>main(){ /*Program to read a number and print it out digit by digit as a series of words*/ char inputNumber[100];  int numLen, i=0; printf("\nEnter a number: "); scanf("%s", inputNumber); printf("\n%s in words: ", inputNumber); numLen = strlen(inputNumber); for(i=0; i<numLen; i++) {  switch(inputNumber[i])  {   case ‘0’:     printf("Zero ");    break;   case ‘1’:     printf("One … Continue reading

Posted in Information Technology | Leave a comment

Custom Sort: Define your own sorting sequence

using System;using System.Collections.Generic;using System.Text; namespace ConsoleApplication1{    class CustomSort    {        static void Main(string[] args)        {            //Create the reference array for custom sort            string[] refArray = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",                                   "a", "b", "c", "d", … Continue reading

Posted in Information Technology | Leave a comment