loops - Why is the following C code asking input twice? -


#include<stdio.h>  int main() {   int i, j;   for(scanf("%d ",&i); i<=10; i++)     printf("%d ",i);   return 0; } 

i beginner in programming world please me understand why on compiling above c code asks inputs twice.maybe there's logic loop here might missing. please me understand.thanks in advance.:)

change this:

scanf("%d ",&i); 

to this:

scanf("%d",&i); 

read more in what space in scanf mean?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -