Advertisement

Output : If the limit=5, then the output will be 1 4 7 10 13.


#include<conio.h>
#include<stdio.h>
#include<math.h>

void main()
{   clrscr();
    int i,n,sum;
    printf("limit=");
    scanf("%d",&n);
    sum=1;
    i=1;
    while(i<=n)
    {   printf("%d ",sum);
                sum=sum+3;
       i++;

       }

       getch();
       }

No comments:

Post a Comment

Please comment bellow. Share your knowledge