INCREMENT OPERATOR

In C, the increment operator is used to increase the value of a variable by 1. There are two forms of the increment operator: postfix (++) and prefix (++). Here's how they work:

#include<stdio.h>

void main()

{

  int i=0;

  i=i+1;                      //1

  printf(“%d”,i);       //1

  i++;                        //2

  printf(“%d”,i);      //2

  i=0;

  printf(“%d”,i++);     //0

  i=0;

  printf(“%d”,++i);      //1

  //i++ means first to use the value then increase the value

  //++i means first increase the value then use the value    

}

Write a program to print value from 1 to 10 using while loop

#include<stdio.h>

void main()

{

  int i=0;

  while(i<=10)

{

  printf(“%d”,i);

  i++;

}

}