Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Given a simple program designed to take inputs of integers
from 1-1000 and to output the factorial value of that
number, how would you test this program? You do not have
access to the code. Please be as specific as possible.

Answer Posted / vaibhav nigam

@ Min Soo Kim

i will use your concept but in a better way like:
there is no need to make any f() function to calculate
factorial.

some lines of code:

main()
{
int a,b;
cin >> a;
bool check=1; //'1' for correct and '0' for wrong answer
if(a!=1)
check=0;
else {
for(int i=2; i<=1000; i++) {
cin >> b;
if(a*i!=b) {
check=0;
break;
}
a=b;
}
}
if(check)
printf("correct");
else
printf("wrong");
}


// since factorial(1000) is a very large value, so another
container can be used but logic remains same

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What c++ library is string in?

1000


What is purpose of abstract class?

1018


What are the basics of local (auto) objects?

1078


Is there structure in c++?

972


What does catch(…) mean?

1066


How would you implement a substr() function that extracts a sub string from a given string?

993


What are static type checking?

1009


What is auto type c++?

1076


Is c++ free?

1039


What is abstraction c++?

946


Why is "using namespace std;" considered bad practice?

1036


What is the error in the code below and how should it be corrected?

708


What is a syntax in c++?

1107


What is low level language in simple words?

977


Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D

3602