Page 1 of 1

घ Write a for loop that prints firstNumber...-10. Ex: If the input is: -3 the output is -3-2-18 1 #include 2 3

Posted: Fri Jun 10, 2022 11:55 am
by correctanswer
 1
1 (30.34 KiB) Viewed 124 times
घ Write a for loop that prints firstNumber...-10. Ex: If the input is: -3 the output is -3-2-18 1 #include <stdio.h> 2 3 int main(void) 4 int firstNumber; 5 int i; 6 7 scanf("%d", &firstNumber); 9 for(i-firstNumber:1-0;1-) { printf("%d", 1); 10 11 } 12 13 return 0; 14 Check Try again X The loop starts with the value input into firstNumber, and ends with 0 due to the <- in the loop expression if first Number is assigned to a number greater than 0 the loop condition is immediately false and the loop is never entered 1: Compare output Output differs See highlighte below