program to get 1+1,1+2,1+3,1+4,1+5,.... to nth term.

//program to get of 1+1,1+2,1+3,1+4,1+5,....           to nth term.
void main()
   int i,n,k=1;
      printf("enter  positive number for 'n'\n");
logics in mind:
->enter a number for range for which you want to get/print , say 'n'.
->let a variable k=1 with initial value '1'. We take this because first term has value '1'.
->Now we display each of the term using special format as shown above using printf.
->For first term we take variable k then we put characters '+' and ten 'i' because its value is changing 
  as the loop changes. We get that term.

No comments:

Post a Comment