Hi, need help with an assignment. Here is the problem and the code the I came up with. When I run it, it displays the numbers but it duplicates the same line but with the incremented number.
Create a C program that will accept 2 numbers: (Start Number and End Number) then display all numbers from the Start Number up to the End Number.
Code:
#include<stdio.h>int main()
{
int x,y,z;
printf("Enter 1st number: ");
scanf("%d",&x);
printf("\nEnter 2nd number: ");
scanf("%d",&y);
{
for (z=x;z<y;z++)
printf("\nNumbers are %d to %d",z,y);
getch();
}
}