Condition and Loop problems

write a program which will take N integer from user and print all the numbers between N to -32 stop your program when user will give N=-1
code:

#include<stdio.h>
int main()
{
    int i,n;
    for(;;)//while(1) //eta aschey karon loop chara program theke bair howa jay bna so break er jonno loop asche
    {
        printf("enter no:");
        scanf("%d",&n);
        if(n==-1){
            break;
        }
        if(n>-32)
        {
            for(i=n; i>=-32; i--)
                printf("%d\n",i);
        }
        else if(n<-32)
        {
            for(i=n; i<=-32; i++)
                printf("%d\n",i);
        }
    }



    return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *