Print Negative Series
C Program to print negative series 0, -1, -2, -3, -4, -5.... for the given value of -N.
For example, if n = -5, output will be 0, -1, -2, -3, -4, -5
#include <stdio.h>
int main()
{
int i, n;
printf("Enter n:");
scanf("%d", &n);
for(i=0; i>=-5; i--)
{
printf("%d ", i);
}
return 0;
}
Output of Program Execution-1
Enter n:-3
0 -1 -2 -3
Output of Program Execution-2
Enter n:-5
0 -1 -2 -3 -4 -5