#include<stdio.h>
main()
{
int i=0;
while(i<=9)
{
printf("Valuea i is :%d\n",i);
*any one no what formula can i use here to make it mutiple 2 *
}
#include<stdio.h>
main()
{
int i=0;
while(i<=9)
{
printf("Valuea i is :%d\n",i);
*any one no what formula can i use here to make it mutiple 2 *
}
1) This is the 21st century, so it's int main(void) not just main().
2) main is supposed to return an integer, 0 in your case.
3) you probably want to do i = i*2 to multiply i by two and store the result back into i.
1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
3. Get rid of conio.h and other antiquated DOS crap headers.
4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.
<< !! Posting Code? Read this First !! >>
Read it before you post any more code.
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.
#include<stdio.h>
main()
{
int i=9;
while(i<=1)
{
printf("Valuea i is :%d\n",i);
*any one no what formula can i use here to make it decreasea by 2*
}
how to make it decreasa by 2?
int i=10;
while(i<=2)
{
printf("Valuea i is :%d\n",i);
*any one no what formula can i use here to make it decreasea by 2*
}
how to make it decreasa by 2?
Last edited by Char*Pntr; 10-15-2010 at 06:03 PM.
Hi hakimastm, here's how you do it. you post your code between these 2 blocks.
[code xxx] put your code here [/code xxx]
Don't include the "xxx" ... I put those in there otherwise you could not see
what wrote.
Take out the "xxx" and try again. :-)
EDIT: I'm copying and pasting the example from the moderator's link:
How do I use code tags?
Well if you have any experience with HTML it is fairly simple to use. A tag has a beginning and ending. A beginning tag looks like this: [tag] and an ending tag looks like this: [/tag xxx] . The tag name for the code tag is simple, it is "code". So to begin a code tag, type the following: [code] . Then type all your code or copy and paste, whatever you want. When you are done, use the closing tag which uses the same tag name but with a forward slash to denote a closed tag: [/code] .
Last edited by Char*Pntr; 10-15-2010 at 06:13 PM. Reason: additional info
Spoon feed me! Do my homework! I have an avatar of a GIRL!!!
/rolleyes
RtoR I can relate to what you're saying, because I think I have seen
that in other threads.
However, there are few factors in this case which should be considered:
1) I'm very married, happily married to a Thai lady who wrote to me English in
exactly the same way when at the beginning we were pen pals 14 time zones away.
2) I would have had precisely the same response to a male person in the same situation.
RtoR I thoroughly enjoy reading your posts, and I like to learn how to detect
cross posts, a skill that you have mastered.
My main concern, was that a non-native English speaker is having a hard time, and I only
wanted to help.
Since you have your doubts, and I want to continue for us to have a good relationship
:-) I'm done with this thread.
Edit: Your reply was funny, and it made me laugh. I do have a sense
of humor - so this should be proof of no hard feelings on my part. :-D
Last edited by Char*Pntr; 10-15-2010 at 07:20 PM.
Char*Pntr it wasn't meant as a criticism of you