0

Anyone pls tell me step by step process in this code

#include <stdio.h> int main() { int i,j,n; //enter numbers in between 1-25 printf("enter 5 numbers with space: "); for(i=1;i<=5;i++) { scanf("%d",&n); printf("\n%2d ",n); for(j=1;j<=n;j++) printf("*"); } return 0; }

25th Dec 2019, 5:55 AM
mohd ajmal
2 Antworten
+ 3
I'll try to answer your question in a pseudocode kind of way. I'll start from the main function. 1. Integer variables i, j, and k are declared. 2. "enter 5 numbers with space: " is printed 3. i = 1 // start of the outer for loop 4. i <= 5? 5. if step 4 is true, proceed to step 6. If not, go to step 16. 6. asks user for an integer input and assigns it to variable n 7. prints out the value of n with 2 character right alignment (If n is a single digit, it will be moved one space to the right.) 8. j = 1 // start of the inner for loop 9. j <= n? 10. If step 9 is true, proceed to step 11. If not, go to step 14. 11. prints "*" 12. adds 1 to j 13. go back to step 9 14. adds 1 to i 15. go back to step 4 16. // end of program
25th Dec 2019, 6:39 AM
Zerokles
Zerokles - avatar
0
Zerokles thank you bro
25th Dec 2019, 7:46 AM
mohd ajmal