r/C_Programming • u/soul_sagee • Jun 16 '26
How many times will be printed
for(i = 1; i <= n; i = i * 3)
{
for(j = i; j <= n; j++)
{
printf("ABC");
}
}
0
Upvotes
r/C_Programming • u/soul_sagee • Jun 16 '26
for(i = 1; i <= n; i = i * 3)
{
for(j = i; j <= n; j++)
{
printf("ABC");
}
}
•
u/mikeblas Jun 16 '26
I've locked this post:
20
u/wtfbenlol Jun 16 '26
why don't you study and not ask others to do your homework
12
u/Bitdomo92 Jun 16 '26 edited Jun 16 '26
none
you did not declare i, j and n. you did not include stdio.h and you forgot the main function
19
u/wtclim Jun 16 '26
Run the code and find out.
5
u/Maxsmart007 Jun 16 '26
You're making us do your homework and you don't even know the material well enough to include all the information required to solve this problem. We don't see a declaration of N, I, or J in this block.
2
u/pfp-disciple Jun 16 '26
If you're serious, then show what you've worked out.
1
u/a4qbfb Jun 16 '26
There is no way to tell without knowing the types of
i,j, andnand the initial value ofn.1
u/____sumit____ Jun 16 '26
Is copy pasting code too hard?
1
u/TheThiefMaster Jun 16 '26
the outer loop i will run
ceil(n/3)timesthe inner loop will run
(n-i+1)times each outer loop0
u/Worldly-Crow-1337 Jun 16 '26
None. Variable “i” is out of scope.
7
u/[deleted] Jun 16 '26
[removed] — view removed comment