Fill in the blanks of this code to print out the numbers 1 through 7.
Answers
Answered by
11
Answer:
number = 1
while number <= 7:
print(number, end=" ")
number = number + 1
Explanation:
You just need to go from 1 and also include 7, as they have written through 7.
Answered by
0
To print the numbers 1 through 7 we can use basically different programming languages like c languages, python, and java. Herewith c language we can construct it with 2 loops:
- For loop-
#include<stdio.h>
int main()
{
int x;
printf("\n");
for(x=1;x<=7;x++)
{
printf(" %d",x);
}
getch();
return 0;
}
- While loop-
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("\n");
n=1;
while(n<=7)
{
printf(" %d",n);
n++;
}
getch();
}
Similar questions