Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:05:19+00:00 2026-06-14T12:05:19+00:00

Create a program to find out the first perfect square greater than 1 that

  • 0

Create a program to find out the first perfect square greater than 1 that occurs in the Fibonacci sequence and display it to the console.

I have no output when I enter an input.

#include <stdio.h>
#include <math.h>

int PerfectSquare(int n);
int Fibonacci(int n);

main()
{
    int i;
    int number=0;

    int fibNumber=0;
    int psNumber=0;


    printf("Enter fibonacci number:");
    scanf("%i",&number);


    fibNumber = Fibonacci(number);

    psNumber = PerfectSquare(fibNumber);

    if(psNumber != 0){
        printf("%i\n",psNumber);
    }
}



int PerfectSquare(int n)
{

    float root = sqrt(n);
    if (n == ((int) root)*((int) root))
        return root;
    else
        return 0;
}

int Fibonacci(int n){
    if (n==0) return 0;
    if (n==1) return 1;
    return( Fibonacci(n-1)+Fibonacci(n-2) );
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:05:20+00:00Added an answer on June 14, 2026 at 12:05 pm

    Luke is right. If your input is n, then the Fibonacci(n) returns the (n+1)th Fibonacci number.
    Your program check whether (number +1)th is perfect square or not actually.

    If you enter 12, then there is output. Because the 13th Fibonacci number is 144. And it is perfect square. PS: print fibNumber instead of psNumber.

            printf("%i\n", fibNumber);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create program that creates a XML schema like below using System.Xml.XmlSchema
I want to create a program that runs on iPads, Playbooks, and Windows computers
I want to create a program that produces an executable slideshow. So I need
I am trying to create a program that will get data directly from socket
I am trying to create a program that will be passed input data from
I'm trying to create a program that takes a text file of c++ code
I'm trying to create a program that will return a certain number decomposed to
I'm trying to create a Java program that flips two coins to see who
Ok, so I'm trying to create a program using a while loop to find
This is my first time using stackoverflow. I've been unable to find out the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.