#include int main() { //nested loop = a loop inside of another loop int rows; int columns; char symbol; printf(" Enter # of rows: "); scanf("%d", &rows); printf("Enter # of columns: "); scanf("%d", &columns); scanf("%c"); //clears from buffer printf("Enter a symbol to use: "); scanf("%c", &symbol); for(int i = 1; i
nvm i fixed it, it works on devc++ compiler but in online compiler and vscode it didn't so i just add &symbol at the end scanf("%c", &symbol); like this instead of just scanf("%c");
Thank you very much, I was looking for something to explain the nested loop and how they interact which you explained in 3:14, "in order for one iteration of the inner loop to run, the inner loop basically has to end, to stop"
hey! i love your channel! i tried to replicate this code and for some reason, it prints the character twice the number i put in columns, i fixed it by making the initial value of j = 6, but i dont think thats supposed to happen, cause it doesnt make any sense. please help?
You could also write getchar(); to consume the /n or you could add a space before %c like this scanf(" %c", &symbol); to tell it to ignore whitespace characters such as /n.
#include
int main()
{
//nested loop = a loop inside of another loop
int rows;
int columns;
char symbol;
printf("
Enter # of rows: ");
scanf("%d", &rows);
printf("Enter # of columns: ");
scanf("%d", &columns);
scanf("%c"); //clears
from buffer
printf("Enter a symbol to use: ");
scanf("%c", &symbol);
for(int i = 1; i
i tried to run this but any number i input it always show 10 columns, why is that?
nvm i fixed it, it works on devc++ compiler but in online compiler and vscode it didn't
so i just add &symbol at the end scanf("%c", &symbol); like this
instead of just scanf("%c");
@@nem0103 thanks had same issue
thx@@nem0103
if the scanf("%c"); don't work for some peoples, replace it by getchar(); at the same place he put the scanf("%c");
thank you so much man
@@baradelv_ ur welcom bro
thanks
Hello, it still doesnt work. What should I do?
@@melsa8594 use scanf(%*c);
Thank you very much, I was looking for something to explain the nested loop and how they interact which you explained in 3:14, "in order for one iteration of the inner loop to run, the inner loop basically has to end, to stop"
you could also scan past the
character from scanf by putting a space before “%c”
like “ %c”
correct me if i’m wrong tho lol
thnx G IT WORKS
at here right?: printf("Enter a symbol to use: ");
scanf(" %c", &symbol);
@@ahmetyusufata2710yeah i think that’s right
thanks, Bro (Code)
my problem is I need to do a 5 10 15 20 up to 500 but it should be at 11 rows. how do I do that.
First loop i is 11 times . Then 2nd loop just incremeent j += 5
hey! i love your channel! i tried to replicate this code and for some reason, it prints the character twice the number i put in columns, i fixed it by making the initial value of j = 6, but i dont think thats supposed to happen, cause it doesnt make any sense. please help?
vsc gets hung up on the fact that the additional scanf statment(the one added to clear the
) and it wont compute correctly
You could also write getchar(); to consume the /n
or you could add a space before %c like this scanf(" %c", &symbol); to tell it to ignore whitespace characters such as /n.
My end results prints to infinite it never stops unless I kill the terminal and I did exactly like you did. What could I have done wrong?
Here's a nested loop I made:
#include
#include
#include
#include
#include
int main(){
for(int i = 0; i
what is this abomination
thank you bro
why my output is 10 columns even though I type another number when enter the columns
?
Are you on a Mac? I have the same issue, using getchar(); instead of scanf("%c"); solves the problem, as suggested in comments below.
Hey thanks man , that worked
It recognises the enter rows, columns, and symbol but after that nothing prints ??
tried anything but it just keeps saying more% conversions than data arguments
same here
Create a Program applying NESTED LOOP that will display the output 123 345 567. please help me i can not do it
If you still need it. This should work.
#include
int main(void)
{
int j = 2;
int count;
for(int i=1; i
Hi there, love ur channel! please post the code? Thanks!
code... where?
whatever anything before or after or anything or I do or did or anything or anytime
75 views…
thank uuuuuuuu
it's the alone video than i want to have the code, and... nothing