c linguaggio %d code example

Example: c

#include <stdio.h>

//main() is the main function for C
int main(){
	
	//int defines an integer variable
	int txt;

	//scanf() inputs the value you give it
	//%d defines that the value is an integer
	//& indicates that you're inputting a variable
	scanf("%d",&txt);

	//printf() outputs the value you give it
	//the %d is our "txt" variable, assigned by putting ",txt"
	printf("%d",txt);

	//return 0 indicates the end of the script
	return 0;
}

//P.S. always remember to put semicolons at the end of a line ;)

Tags:

C Example