Livefusion

Icon

Programmers heaven…Lamers Hell

Ascending Pyramid of Numbers in C

#include < stdio.h >
int main() {
int i,j,rows;
printf(“Enter the number of rows: “);
scanf(“%d”,&rows); for(i=1;i<=rows;++i)
{
for(j=1;j<=i;++j) { printf(“%d “,j);
}
printf(“\n”);
}
return 0;
}
 
Output:

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

Filed under: Basic,

C/C++ Problem Set Part 2

So here we go here is the list of the questions.

1.Concatenate two linked lists.
2.Write a program to raise no to power when both are floating number.
3.Evaluate a given polynomial of 6th order.
4.Write program to print binary equivalent of number or hex,octal number.
5.Given a date as 27-5-1983 compute the date after 5 days ,30 days and 200 days.
6.Multiply the two matrices  of diffrent orders.
7.Write a program to compare two strings,return comaprison elements.
8.Write a nested MACRO that returns minimumof 3 values.
9.Write a program to accept the file from user,count the number of lines in file without opening it.
10.Remove the duplicate elements from a list in an array.

Filed under: Basic, Puzzles &Teasers

C/C++ Problem Set Part 1

Here are some of the problems for beginners to intermediate.These are kind of homework problems,you can use it to improve logic.If you want to answer in comments,do send it in format below:

Program name:
Compiler used :
Source code:
Your name :

So here we go here is the list of the questions.

1.Write a program to add one file into another.
2.Count the number of elements in a linked list and delete the last 3 elements.
3.Write program that counts all occurances of perticular word.
4.Reverse digits of an integer.
5.Write program to read name of person & return the ascii value of it.
6.Write a code to find factorial of any number.
7.Concatenate two linked lists.
8.Test whether the given string is a plaindrome(reads the same in both directions)
9.Find the square root,cube rrot without using the c library function.
10.Write a program to accept file from user and count the vowels in it with or without opening it.
11. Try to produce the output as below:

1
1 2
1 2 3
1 2 3 4
1 2 3 4        
*  *   *
*   *   *   *
*    *   *    *    *
*   *   *   *    *   *

12. Write a program to find the hex values of given number.
13.Write a program to find ASCII value of key typed.

Hope you will find this question set helpful.Do post your own problems if you have any.You can even post your answers here.

Filed under: Basic, Puzzles &Teasers

Puzzle – Try it first without compiling

#include <iostream> Read the rest of this entry »

Filed under: Basic

To remove a C program by itself after its execution

//The following program will serve your purpose. Read the rest of this entry »

Filed under: Basic

Print without semicolon

void main()
{
if(printf(“hello”))
{
}
}

More about this later.

Filed under: Basic, Puzzles &Teasers

Swapping without temporaries

This is the question i have got from most of the forums and usenet groups.check out this cool code. Read the rest of this entry »

Filed under: Arrays & pointers, Basic

Program to remove repeated occurance of char in string

void main()
{ Read the rest of this entry »

Filed under: Arrays & pointers, Basic

Puzzle for fun

WAP to print numbers from 1 to 100 without using any condition checking statment Read the rest of this entry »

Filed under: Arrays & pointers, Basic, Functions & Structures, OOP

Rotation problem

rotate a one-dimentional array of n elements Read the rest of this entry »

Filed under: Basic, OOP