Thread: product using adition

  1. #31
    Notorious Turbo C killer blacksnake's Avatar
    Join Date
    Jan 2007
    Location
    philippines
    Posts
    50

    Exclamation end result:

    this program show at the last thread of the second page may encountered runtime error...as you input two numbers, the answer is not correct...is there something wrong with the program or the code?

    example:

    num1=3
    num2=5
    product=1549

    it should be:

    num1=3
    num2=5
    product=15

  2. #32
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Changes in red
    Code:
     
    // This program based on the old version of BORLAND C++
    #include <iostream.h>
    #include <conio.h>
    int main()
    {
    	int x;
    	int y;
    	int product = 0;
    	
    	cout<<"input first number:";
    	cin>>x;
    	cout<<"input second number:";
    	cin>>y;
    	
    	for(int i=0; i<x; i++)
    	{
    		product +=y;
    	}
    	
    	cout<<"Product is:"<<product;
    	getch();
    	return 0;
    }
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #33
    Notorious Turbo C killer blacksnake's Avatar
    Join Date
    Jan 2007
    Location
    philippines
    Posts
    50

    Cool conclusion

    therefore, this program satisfies the problem...to all users behind it who help to solve...thank you....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Matrix product
    By Cotizo in forum C++ Programming
    Replies: 4
    Last Post: 08-03-2008, 10:10 AM
  2. ...multiplication using stacks
    By iiwhitexb0iii in forum C Programming
    Replies: 1
    Last Post: 10-09-2006, 01:28 AM
  3. Product Keys
    By codegirl in forum Tech Board
    Replies: 6
    Last Post: 05-20-2006, 02:55 PM
  4. Microsoft Product Activiation loopholes
    By Liger86 in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 07-08-2005, 05:20 PM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM