Solved

Guys help please!!!

Posted on 2016-09-07
4
42 Views
Last Modified: 2016-11-12
I'm having trouble with my %ctr% dont know if its the right code for this
what I'm looking is if you multiply 7 to 7 the output should come to this:
1 x 7=7
2 x 7=14
3 x 7=21
4 x 7=28
5 x 7=35
6 x 7=42
7 x 7=49

Open in new window

this is my code:
@echo off

:start

set /p i=insert a number:
set /p a=multiplied times:
goto multi

:multi
set /a ctr=%ctr%+1 -->problem
set /a pro=%i%*%a%
echo %i% x %a%=%pro%
pause

goto start

Open in new window



thanks Guys :)
0
Comment
Question by:clinton Pitas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 500 total points (awarded by participants)
ID: 41787418
Use a count loop (and do yourself a favor and use self-explaining variable names instead of letters).
@echo off
setlocal enabledelayedexpansion
:start
set Number=
set /p Number=insert a number, or nothing to exit: 
if "%Number%"=="" goto :eof
set /p Times=multiplied times: 

for /L %%i in (1, 1, %Times%) do (
	set /a Product = %%i * Number
	echo %%i x %Number% = !Product!
)
pause
goto start

Open in new window


And please post code in "Style Code" tags (see the tool bar above the Comment box).
1
 

Author Comment

by:clinton Pitas
ID: 41787440
Thank you oBdA,,,
Im very grateful to you and also gave me an advice...
hope to ask you again sometimes... :)
0
 
LVL 85

Expert Comment

by:oBdA
ID: 41884531
Question answered.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question