473,405 Members | 2,334 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,405 software developers and data experts.

Body of For loop

10
Assume the int variables i and result , have been declared but not initialized. Write a for loop header -- i.e. something of the form

for ( . . . )
for the following loop body:

result = result * i;
When the loop terminates, result should hold the product of the odd numbers between 10 and 20.

NOTE: just write the for loop header; do not write the loop body itself.
Oct 11 '06 #1
2 8020
koder
23
sorry,i could not get your question correctly,if some got a better code please let me know

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2.  
  3. main()
  4.  {
  5.    long i;
  6.    long result=1;
  7.    for(i=10;i<20;)
  8.     {
  9.         if((i%2))
  10.          {
  11.         result=result*i;
  12.          i++;
  13.          }
  14.         i++;
  15.     }
  16.  printf("\n %d",result);
  17. }
thanks a lot and sorry for the whole code posting
Oct 11 '06 #2
hi brother

first of all we will ahve to initilize result or declared it as static variable
if we does't do above things then the variable have a garbage value in it and the result will not you want

the loop for

for(i=11;i<20;i=i+2)
{
result=result*i;
}
Oct 11 '06 #3

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

Similar topics

16
by: Chuck Amadi | last post by:
Sorry to bovver you again (again) here's script. I still can't see why the get_payload() doesn't produce the plain text message body of an emails in the testwwws users mailbox. As you can see I...
6
by: mike | last post by:
I have created a side application in VB.NET which reads rows from a DB and builds an email message. when i have a long string the the mailmessage.body or the mailmessage, it puts in an...
8
by: localhost | last post by:
I would like to wrap all of the HTML inside of my <body> tag inside a <div> with in my code-behind. I do not want to touch the .aspx page template at all. I know how to make the body tag...
10
by: Zeez | last post by:
Hello! I'm looking for a way to stretch an HTML page. I found a way to zoom into a web page by using this code: body.style.zoom = 200%. (this piece of code magnifies the page 2 times larger)...
6
by: vlsidesign | last post by:
If I have a "for" loop like this: for (i = 0; i < 10; i++) or like this for (i = 0; i < 10; ++i) both of the "for" loops will function the same. I also noticed if I use a variable called j...
5
by: swarnavplsql | last post by:
In this code ,i think in insert statement select quary returning more than one value, that is only error .....plz tell me any body cursor c1 is select...
10
by: Remus | last post by:
Greetings, My first time on this forum. I hope someone can help me out. I am trying to get 11 values from several different identically structured webpages. I have the list of webpages saved as...
1
by: sxwend | last post by:
I am trying to use the following post results (http://www.thescripts.com/forum/thread189759.html) and add another requirement. I need to send the results to just the email addresses that the query...
10
by: Dan2kx | last post by:
Hello to all, i have a new interesting problem to solve.... i have a report that i would like to email to a list of users, the report is a full page document and is personalised to each user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.