answersLogoWhite

0


Best Answer

see the program

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the code of a c program that will read in a positive integer value and determine If the integer is a prime number and If the integer is a Fibonacci number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a java program to print the last digit in Fibonacci series?

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.


Write a program that input a positive integer and prints a triangle using for loop?

write a program that reads in the size of the side of square and then pints a hollow square of that size out of asterisks and blanks?


Write a program to print the Fibonacci series in php upto input value using recursive function?

The Fibonacci sequence uses recursion to derive answers. It is defined as: F0 = 0 F1 = 1 Fn = F(n - 1) + F(n -2) To have this sequence printed by a php script use the following: function fibonacci($n) { if($n 1) return 1; //F1 else return fibonacci($n - 1) + fibonacci($n - 2); //Fn } This recursive function will print out the Fibonacci number for the integer n. To make it print out all the numbers in a particular set add this to your script. for($i = 0; $i < 15; $i++) { echo fibonacci($i) . "<br />"; } So your final result would look like. <?php function fibonacci($n) { if($n 1) return 1; else return fibonacci($n - 1) + fibonacci($n - 2); } for($i = 0; $i < 15; $i++) { echo fibonacci($i) . "<br />"; } ?>


Write a c program Fibonacci series using for loop in java?

Exactly what do you mean by 'C program in Java'


Write a program to subtract integer y from integer x?

x -=y;


Can you explain the program of Fibonacci series in c?

You mean you have written a program, but you don't understand it? Well, how could I explain it without seeing it?


Is -5 a integer?

1 hour ago my c program said no, but now I know 5 actually is an integer!


Program to generate Fibonacci series using storage class in c plus plus?

i dn't know. haha


Write a program that prompts the user to input a positive integer It should then output a message indicating whether the number is aprime or not?

Output a prompt.Either:Read from standard input (std::cin) to an integer.Or:Read a line from standard input (std::getline()) to a string.Create a string stream (std::stringstream) to read the string.Read from the string stream to an integer.For each integer from 2 to half the entered integer:If the entered integer is divisible by the current integer:The number is not prime.Exit the program.The number is prime.Exit the program.


8 Write a program in VB.NET to display all Fibonacci Numbe000000000rs less than 610?

it would be a simple loop... something like dim counter as integer dim f1 as integer dim f2 as integer dim f3 as integer counter = 0 f1 = 0 f2 = 1 listbox.additem(f1) listbox.additem(f2) While (count <= 610) ( f3 = f2+f1 f1=f2 f2=f3 listbox.additem(f3) ) next count Those lines of code aren't purfect (you can't copy and paste) but the idea behind the loop will be the same. This will out put the numbers into a list box. If you want to do it in like... a message box, you could do: dim answer as string answer = f1 &" " & f2 while ( ) answer = answer & " " & f3 next count msgbox.show("The first 610 Fibonacci numbers are: " & answer) Shoot me any questions via email @ kjhansen1@cox.net


What is the C plus plus program to print the sum of all squares from 1 to n?

#include<iostream> #include<sstream> using namespace std; unsigned sum_of_squares (const unsigned max) { if (max==0) return 0; if (max==1) return 1; return sum_of_squares (max-1) + (max*max); } int main () { unsigned num = 0; while (1) { cout << "Enter a positive integer (0 to exit): "; string s; cin >> s; if (s[0]=='0') break; stringstream ss; ss << s; if (ss >> num) { cout << "The sum of all squares from 1 to " << num << " is: " << sum_of_squares (num) << endl; continue; } cerr << "Invalid input: " << s << endl; } cout << "Quitting..." << endl; } Example output: Enter a positive integer (0 to exit): 1 The sum of all squares from 1 to 1 is: 1 Enter a positive integer (0 to exit): 2 The sum of all squares from 1 to 2 is: 5 Enter a positive integer (0 to exit): 3 The sum of all squares from 1 to 3 is: 14 Enter a positive integer (0 to exit): 4 The sum of all squares from 1 to 4 is: 30 Enter a positive integer (0 to exit): 5 The sum of all squares from 1 to 5 is: 55 Enter a positive integer (0 to exit): 6 The sum of all squares from 1 to 6 is: 91 Enter a positive integer (0 to exit): 7 The sum of all squares from 1 to 7 is: 140 Enter a positive integer (0 to exit): 0 Quitting...


Where can I find advice and information on skinny bitch?

You can find information on skinny bitch on the website skinnybitch.net. It explains the diet and how to acheive positive results. It also helps determine if the program is right for you.