Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

c++ Program not working the way I want it to

$
0
0
The question is:
Write a program that:
a. Find the smallest integer n such that n2 is greater than 12,000.
b. Find the largest integer n such that n3 is less than 12,000.

#include<iostream>
using namespace std;
int main(){
   int smallnumber=0;
   int largenumber=50;
   while (smallnumber*smallnumber<=12000){
   smallnumber++;
   }
   while (largenumber*largenumber*largenumber>=12000){
   largenumber--;
   }
   return 0;
}



The program compiles and runs, but the program just keeps running and wont output or give me any numbers. what do i need to do to fix this? I am new to programming so please keep it as simple as possible

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>