Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
a code which does generic sorting of two sets of 5 inputs and produce a single output of 10 values in asc order.
d first set of input will be num only (including -ve numbers and decimals). The second set will be characters A-J only (case insensitive). Each of the char is assigned progressive values based on Fibonacci numbers. So here, A = 0; B = 1; C = 1; D = 2; E = 3; F = 5; G =8; H = 13; I = 21 and J = 34 and no other characters are permitted.
Posted
Comments
Prosan 1-Jun-12 7:49am    
what are you asking. if user enter 5 than a=5;b=6;c=11;d=17 like

1 solution

It's Fibonacci series I guess:
Try this,
C#
using System;
using System.Collections.Generic;
using System.Text;

namespace fibseries
{

class Program
    {
        static void Main(string[] args)
        {
            int num;
            Console.WriteLine("Please Enter a number:");
             num = Convert.ToInt32(Console.ReadLine());
             Console.WriteLine("\n");
             Console.WriteLine("The first " + num + " number(s) in the fibonacci series are: ");
             FibonacciSeries(num);
             Console.Read();
        }
        // Fibonacci Code
        public static int FibonacciSeries(int n)
        {
             int previous = -1;
             int next = 1;
             for (int i = 0; i < n; i++)
             {
                 int sum = next + previous;
                 previous = next;
                 next = sum;
                 Console.WriteLine(next);
             }
             return next;
         }

    }


More examples:
How to generate Fibonacci series in c#[^]
C# Fibonacci Sequence[^]
Detailed description with some images:
Fibonacci Series Program using Recursion in C#[^]
 
Share this answer
 
v2
Comments
Richard MacCutchan 1-Jun-12 7:13am    
Not a good idea to do people's homework for them.
Prasad_Kulkarni 1-Jun-12 7:54am    
I was just trying to help sir.
Sandeep Mewara 1-Jun-12 8:53am    
It's much more than a help.

I too wanted to tell you to take a call before answering any question if it's a homework question.
Encouraging such question's and people is not good.
Prasad_Kulkarni 4-Jun-12 3:04am    
I am extremely sorry for that. I will not answer such questions (spoon fidding) again.
Sandeep Mewara 4-Jun-12 12:29pm    
Cool. Keep up the good work! :thumbsup:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900