473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to print a string name for 500 times ??

Hi All

Can anybody tell me
How to print a string name 500 times(or some 'n' number of times ) without using loops ?


Thanks In advance'
Pradi !
Dec 18 '06 #1
4 3619
Hi All

Can anybody tell me
How to print a string name 500 times(or some 'n' number of times ) without using loops ?


Thanks In advance'
Pradi !

main()
{
char name[500][50];
int i=0,n;
scanf("%d",&n);
x : if(i<=n)
{
printf("Enter string");
gets(name[i]);
goto x;
}
}
Dec 18 '06 #2
willakawill
1,646 1GB
Hi All

Can anybody tell me
How to print a string name 500 times(or some 'n' number of times ) without using loops ?


Thanks In advance'
Pradi !
Hi
You could use a recursive function which, technically, is not a loop. It is a function that calls itself.

Expand|Select|Wrap|Line Numbers
  1. void printme(long howmany, char *message)
  2. {
  3.    //print the message how you want here
  4.    howmany--;
  5.    if (howmany == 0)
  6.       return;
  7.    printme(howmany, message);
  8. }
Dec 18 '06 #3
Thanks a lot
Pradi !


Hi
You could use a recursive function which, technically, is not a loop. It is a function that calls itself.

Expand|Select|Wrap|Line Numbers
  1. void printme(long howmany, char *message)
  2. {
  3.    //print the message how you want here
  4.    howmany--;
  5.    if (howmany == 0)
  6.       return;
  7.    printme(howmany, message);
  8. }
Dec 18 '06 #4
willakawill
1,646 1GB
Thanks a lot
Pradi !
Welcome a lot :)
Dec 18 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Balaji | last post by:
Hello Eveybody, I have written a method which prints the prefix notation of any expression. here is the method... def PrintPrefix(expr): if expr.__class__==E: print expr.operator,...
6
by: Ruchika | last post by:
Hi, I am new to Python, so this may be a very simple question for most of you. What does the % operator stand for in Python? I came across a script that uses the % operator as follows - def...
3
by: Adam Monsen | last post by:
The following code uses the % operator to print possibly unitialized data attributes: ------------------------8<------------------------ class J: name = '' value = '' def __str__(self): vals =...
8
by: Hank Reed | last post by:
Hello, I have searched through dozens of old responses to this question but have been unable to make it work in my situation. I'm using Access 2000 We have a very old sticker printer on a...
2
by: Dean Slindee | last post by:
Anybody written code in VB.NET to: 1) show a print preview window of reports already written and stored in an Access 2002 database; or 2) execute the print of a report stored in an Access 2002...
1
by: Michael Beck | last post by:
I need to select one of about 15 printers, which I have been able to do. Then I need to set that printer as the printer to use, run a Crystal Reports reports, and track if/when the printing job...
12
by: Jchick | last post by:
Boy, this should be a simple bit of code but I can't figure out how to make it happen. I have a CSV file shows up in a directory that has 4 fields that need to be printed on labels. Each line of...
2
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, #...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.