This program is about print the positive and negative numbers upto given limits using While Loop
#include<stdio.h> int main() { int i,n,pos,neg; printf("\nEnter the starting value:"); scanf("%d",&i); printf("\nEnter the Ending value:"); scanf("%d",&n); printf("\nNegative numbers:"); while(i<=n) { if(i<0) { printf("\n%d",i); neg++; } i++; } printf("\nPositive numbers:"); i=0; while(i<=n) { if(i>0) { printf("\n%d",i); pos++; } i++; } printf("\nTotal number of Positive :%d",pos); printf("\nTotal number of Negative :%d",neg); return 0; }To download raw file Click Here
Enter the starting value: -6 Enter the Ending value: 6 Negative numbers: -6 -5 -4 -3 -2 -1 Positive numbers: 1 2 3 4 5 6 Total number of Positive:6 Total number of Negative:6
Learn All in Tamil © Designed & Developed By Tutor Joes