![]() ![]() The program then prompts the user to enter the starting and ending values using the "printf" function and stores the values in the variables "i" and "n" using the "scanf" function. The variable "i" is used to store the starting value entered by the user, "n" is used to store the ending value entered by the user, "pos" and "neg" are used to count the total number of positive and negative numbers respectively and "s" is used to store the initial value of "i" so that it can be reused later in the program. Within the main function, the program declares four variables: "i", "n", "pos", "neg" and "s". The program starts by including the standard input/output library (stdio.h) and then defines a main function. This program is written in the C programming language and is used to print the positive and negative numbers between a given range of values and count the total number of positive and negative numbers. ![]() Print and Separate the Positive and Negative Numbers Using For Loop in C
0 Comments
Leave a Reply. |