Click here to Skip to main content
15,867,750 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How do you make a plain code with a loop? I am not good at this. Help me please. Thank you guys! Here is what I have so far:

#include "stdio.h"
int main(void) {
int aa;
  printf("This code will create a loop\n");
printf("Enter code");
scanf("%i",&aa;)
printf("You have entered %i",&aa;)
printf("/n")
printf("This will be looped now.);
loop;
  return 0;
}


What I have tried:

I think so far it is working good
Posted
Updated 3-Mar-21 5:19am

I think you would benefit from getting a copy of The C Programming Language - Wikipedia[^] and spending some time learning the language in proper detail.
 
Share this answer
 
Quote:
I think so far it is working good

Well ... not in terms of actually looping ... or even compiling ...

In order to loop, you need to use a loop construct:
1) do ... while. This executes at least once, and tests at the end to see if it should go round again.
2) while. This executes zero or more times, testing at the beginning of each loop to see if it should execute the loop body or not.
3) for. This executes a number of times, and allows you to change the value after each time around.

You will find details on how to use them here:
do...while loop in C - Tutorialspoint[^]
while loop in C - Tutorialspoint[^]
for loop in C - Tutorialspoint[^]
As a beginner, you should use these constructs only to make your code loop!
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900