click on this link......

LinkGrand.com

Friday, 11 January 2013

To print odd number series from 1,3,5,7,9,11.....n using 'for' loop

#include<stdio.h>
#include<conio.h>
void main()
{
             int i,num;
            printf("Enter the last number:");
           scanf("%d",&num);
             for(i=1;i<=num;i=i+2)
             {
                      printf("\n%d",i);
            }
            getch();
}

pogram to print odd number series
pogram to print odd number series
output for odd number series
output for odd number series

      

11 comments:

  1. 1
    3 1
    5 3 1
    7 5 3 1
    9 7 7 3 1
    How to write c code for this

    ReplyDelete
  2. 1
    3 5
    7 9 11
    13 15 17 19
    21 23 25 27 29
    31 33 35 37 39 41
    please tell me about this code

    ReplyDelete
    Replies
    1. answer the code in c programming

      Delete
    2. Include
      Main()
      Int i,j,a=1;
      For(i=1;i<=6;i++)
      {
      For(j=1;j<=i;j++)
      {
      Printf("%d",a);
      A=a+2;
      }
      Printf("\n");
      }
      Getch();
      }

      Delete
  3. 1 3 5
    7 9 11
    13 15 17 answer the code in c

    ReplyDelete
  4. plz answer me the code of 1+2+4+8+16+...+n in c

    ReplyDelete