C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Times Table Posted by relientkrocks on 13 Oct 2005 at 10:41 AM
How would I program a Times Table using looping in C?
Report
Re: Times Table Posted by stober on 13 Oct 2005 at 12:07 PM
: How would I program a Times Table using looping in C?
:

what operating system and compiler? do you just want to display it on the screen or save it into a file? How big a times table (such as from 1 to ???) ?

Report
Re: Times Table Posted by relientkrocks on 14 Oct 2005 at 8:34 AM
: : How would I program a Times Table using looping in C?
: :
:
: what operating system and compiler? do you just want to display it on the screen or save it into a file? How big a times table (such as from 1 to ???) ?
:
:
:im using linux and vi. i want to save the file and i want to be able for it to ask the dimensions. so it will say give number for m: 5. then give number for n: 7. and it will display a timestable for the dimensions that i give it.
Report
Re: Times Table Posted by stober on 14 Oct 2005 at 10:09 AM
: : : How would I program a Times Table using looping in C?
: : :
: :
: : what operating system and compiler? do you just want to display it on the screen or save it into a file? How big a times table (such as from 1 to ???) ?
: :
: :
: :im using linux and vi. i want to save the file and i want to be able for it to ask the dimensions. so it will say give number for m: 5. then give number for n: 7. and it will display a timestable for the dimensions that i give it.
:

start with a very very simple program
#include <stdio.h>

int main()
{
   // put your code here


   return 0;
}


with that, you can start to add code that will display the prompts and get keyboard input for the dimensions. (hint: use printf() to display text) when that is working correctly, then you can code the part that makes the multiplications. Once all that is done and working, you can spend your efforts on writing the table to a file.


Report
Re: Times Table Posted by istrasci on 14 Oct 2005 at 10:16 AM
: : : How would I program a Times Table using looping in C?
: : :
: :
: : what operating system and compiler? do you just want to display it on the screen or save it into a file? How big a times table (such as from 1 to ???) ?
: :
: :
: :im using linux and vi. i want to save the file and i want to be able for it to ask the dimensions. so it will say give number for m: 5. then give number for n: 7. and it will display a timestable for the dimensions that i give it.
:


Think about it... For row 1, you want to do 1*1, 1*2, ... 1*7... For row 2, 2*1, 2*2, ... 2*7... So for each row you have, you want to show the product for each column... Well, I basically just did it for you... Just translate it into C now... If you are still having trouble, make an attempt, and post the code of what you tried here for further help...



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.