Question about Computers & Internet

Ad

I'm assuming one of two things, either

A) You need help for a programming class?

or

B) You're just curious?

Either way

#include <iostream>

#include <algorithm>

using std::swap;

using std::cout;

using std::endl;

// Function f returns n'th Fibonacci number

// It uses Algorithm 2C: non-recursive loop

unsigned int f(unsigned int x) {

unsigned int x1=1;

for(unsigned int i=1,x2=1;i<=x;i++) {

x1+=x2;

swap(x1,x2);

}

return x1;

}

// Function f_print prints out n'th Fibonacci number

void f_print(int n) {

cout << n << "th Fibonacci number is " << f(n) << endl;

}

// main is the entry point in C++

int main() {

f_print(46);

}

Posted on Feb 18, 2009

Ad

Hi,

A 6ya expert can help you resolve that issue over the phone in a minute or two.

Best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.

The service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).

click here to download the app (for users in the US for now) and get all the help you need.

Good luck!

Posted on Jan 02, 2017

Ad

not a technical problem for fixya site

Nov 22, 2016 | Optics

Use the sequence plot to represent it.

Apr 08, 2014 | Texas Instruments Office Equipment &...

Assuming that the input numbers are given by the user:print "Menu"print "1. Addition"print "2. Subtraction"print "3. Multiplication"print "4. Division"print "0. Quit"

a = input("Please make a selection:")if a == 1: x = input("Please enter a number:") y = input("Please enter another number:") answer = x + yprint "%r plus %r = %r" % (x,y,answer)elif a == 2: x = input("Please enter a number:") y = input("Please enter another number:") answer = x - yprint "%r minus %r = %r" % (x,y,answer)

The same goes for everything else just with different signs. Don't forget that "*" is multiplication and "/" is division. Also, for 0. Just use:

elif a == 0: quit

a = input("Please make a selection:")if a == 1: x = input("Please enter a number:") y = input("Please enter another number:") answer = x + yprint "%r plus %r = %r" % (x,y,answer)elif a == 2: x = input("Please enter a number:") y = input("Please enter another number:") answer = x - yprint "%r minus %r = %r" % (x,y,answer)

The same goes for everything else just with different signs. Don't forget that "*" is multiplication and "/" is division. Also, for 0. Just use:

elif a == 0: quit

Sep 28, 2011 | Computers & Internet

package com.gpt;

import javax.swing.JOptionPane;

/*

This program computes Fibonacci numbers using a recursive

method.

*/

public class Fibonacci

{

public static void main(String[] args)

{

String input = JOptionPane.showInputDialog("Enter n: ");

int n = Integer.parseInt(input);

for (int i = 1; i {

int f = fib(i);

System.out.println("fib(" + i + ") = " + f);

}

System.exit(0);

}

/**

Computes a Fibonacci number.

@param n an integer

@return the nth Fibonacci number

*/

public static int fib(int n)

{

if (n return 1;

else

return fib(n - 1) + fib(n - 2);

}

}

import javax.swing.JOptionPane;

/*

This program computes Fibonacci numbers using a recursive

method.

*/

public class Fibonacci

{

public static void main(String[] args)

{

String input = JOptionPane.showInputDialog("Enter n: ");

int n = Integer.parseInt(input);

for (int i = 1; i {

int f = fib(i);

System.out.println("fib(" + i + ") = " + f);

}

System.exit(0);

}

/**

Computes a Fibonacci number.

@param n an integer

@return the nth Fibonacci number

*/

public static int fib(int n)

{

if (n return 1;

else

return fib(n - 1) + fib(n - 2);

}

}

Feb 24, 2011 | Sun Java Programming Language (cdj-275)

Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

At first type Fibonacci equation in Y editor with condition x>=0 and then graphing it. See captured images with enlarged form of graph

At first type Fibonacci equation in Y editor with condition x>=0 and then graphing it. See captured images with enlarged form of graph

Apr 11, 2010 | Texas Instruments TI-84 Plus Silver...

Try this site, I think it gives you the best answer:

http://www.scribd.com/doc/10396888/Flowchart-of-Fibonacci-Number-Display-and-Summation

http://www.scribd.com/doc/10396888/Flowchart-of-Fibonacci-Number-Display-and-Summation

Feb 14, 2010 | Global Marketing Partners FLOWCHARTS AND...

my email is verosaka@gmail.com please send your email address and i will send you a tiny program to do it

Jun 29, 2009 | Microsoft Select Application Center...

Write a program to prompt the user to input several lines of input. A line of inputs is terminated by '*'. For each readline of input the program should output:(use pointer notation for the array)
. The total # of words
. The lenght of the longest word in the line
At the end the program should output:
. The total number of words read in all lines of input
. The lenght of the longest word read in all lines of input

Jan 19, 2009 | Computers & Internet

I had the same problem. I solved it by going into program mode, then while holding down the function key, input one of the missing channel numbers. The channel should appear but is flashing. Now input a frequency for the channel and exit program mode. Repeat the sequence for the other missing channels. This procedure worked for me. Good luck.

Nov 19, 2008 | ICOM Informatique Icom Radio U16, IC2GAT,...

Ok! Here's a snippit from some code I wrote in beginning c++ classes. However, don't just cut and paste it. Know how it works since it's important in algorithm examination!

Just tested it, compiles and runs perfectly on GCC 4.0.1 on my mac, as well as my linux boxen. Windows may take some changes to output data.

/***********************************************

* Steven Parker

* Calculating Fib Sequence

* after two starting values, each number is the

* sum of the two preceding numbers

***********************************************/

#include <iostream>

using namespace std;

int main() {

int whentostop = 20; //How many values of sequence to calculate

int fib[whentostop]; //Hold fib numbers

for (int i=0; i < whentostop; i++) {

if (i == 0)

fib[0] = 0;

else if (i == 1)

fib[1] = 1;

else

fib[i] = fib[i-1] + fib[i-2];

cout << "Fibonacci[" << i << "]: " << fib[i] << endl;

}

return 0;

}

Just tested it, compiles and runs perfectly on GCC 4.0.1 on my mac, as well as my linux boxen. Windows may take some changes to output data.

/***********************************************

* Steven Parker

* Calculating Fib Sequence

* after two starting values, each number is the

* sum of the two preceding numbers

***********************************************/

#include <iostream>

using namespace std;

int main() {

int whentostop = 20; //How many values of sequence to calculate

int fib[whentostop]; //Hold fib numbers

for (int i=0; i < whentostop; i++) {

if (i == 0)

fib[0] = 0;

else if (i == 1)

fib[1] = 1;

else

fib[i] = fib[i-1] + fib[i-2];

cout << "Fibonacci[" << i << "]: " << fib[i] << endl;

}

return 0;

}

Nov 12, 2008 | Computers & Internet

153 people viewed this question

Usually answered in minutes!

×