//program to print/display 1+1/1,1+1/2,1+1/3,1+1/4,1+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);
printf("%d+%d/%d,",k,k,k);
for(i=2;i<=n;i++)
{
for(i=2;i<=n;i++)
{
printf("%d+%d/%d,",k,k,i);
}
}
getch();
}
--------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number for range for which you want to display, say 'n'.
}
--------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number for range for which you want to display, say 'n'.
->let a number k with initial value '1'
->display this using printf with characters '/' and others. so or first term, we displayed it.
->for rest of terms, ->we have to go for repetitive process from number 2 to entered number 'n'.
->we display each of term using printf and all other characters as shown above.
->If we get same value then then we display that.
No comments:
Post a Comment