//program to get of 1+1,1+2,1+3,1+4,1+5,.... to nth term.
#include<stdio.h>
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,k=1;
{
int i,n,k=1;
printf("enter positive number for 'n'\n");
scanf("%d",&n);
scanf("%d",&n);
for(i=1;i<=n;i++)
{
{
printf("%d+%d,",k,i);
}
}
getch();
}
--------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number for range for which you want to get/print , say '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