Size Contest (SPOJ Challenge problem 378)

Given the set of integers, find the sum of all positive integers in it. Solutions can be sent in any language supported by SPOJ except Whitespace. Input t – number of test cases [t < 1000] On each of next… Read the rest

Factorial (SPOJ problem 11)

View problem on SPOJ The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every phone connects to… Read the rest

Check whether one string is rotated version of other(Josh software programming test problem-2)

Write a program to accept two strings str1 and str2 and checks whether str2 is rotated version of str1. Ex. Following are different values of str2 for given str1. GIVEN:str1=”software” 2-character left rotate str2=’resoft’ 4-character left rotate str2=’waresoft’ 3-character right… Read the rest

Generate graph from input 1-D array (Josh Software programming test problem-1)

Following program was asked by Josh Software during campus recruitment. Write a program to generate following chart without using any graph library.This is of marks from 1 to 5 obtained by 10 student represented by an array as [2,4,5,1,2,4,1,1,5,2] Y… Read the rest

Remove duplicate characters in string

Write code to remove the duplicate characters in a string without using any additional buffer NOTE: One or two additional variables are fine An extra copy of the array is not. This question is from the book “cracking thecoding interview”.… Read the rest

Recursive insertion sort

// recursive insertion sort in ascending order // #include<stdio.h> void rec_insert(int ,int []); void main(void) { int a[100],i,count; printf("Enter number of elements:"); scanf("%d",&count); printf("\nEnter elements of array:"); for(i=0;i<count;i++) scanf("%d",&a[i]); rec_insert(count-1,a); printf("\nSorted array:"); for(i=0;i<count;i++) printf("%d ",a[i]); } void rec_insert(int i,int a[])… Read the rest

Snake game in C language using queue

Requirments: Turbo C++ compiler If you face any graphics error ,follow these steps.
  • Go to “BGI” folder. ( C:\TurboC++\Disk\TurboC3\BGI).
  • Copy file “EGAVGA.BGI” 
  • Got “BIN” folder. ( C:\TurboC++\Disk\TurboC3\BIN).
  • Paste “EGAVGA.BGI” file .
  • Close Turbo C++ and open it again and run
  • Read the rest