How to use %ld specifier in code? As it doesn’t takes it.
%
means a format specifier, meanwhile l
is length modifier( long integer) and d
is the conversion specifier, i.e. indicating the argument is int.
Hence, this specifier is always used with long integer.
For example:-
To take input from the user, it should be like this
scanf("%ld", &some_variable);
To print on the console
printf("%ld", some_variable);
I insist you to go through this page printf(man) scanf(man)
#include<stdio.h>
long int multiplyNumbers(int n);
int main(){
int n,m;
scanf("%d",&n);
while(n–){
scanf("%d",&m);
printf("%ld\n",multiplyNumbers(m));//AS U CAN SEE HERE THIS LINE IS NOT VALID IN CODECHEIFWHILE I WAS WRITING CODE THE COMPILER IS NOT TAKING THIS FORMAT SPECIFIER WHAT TO USE THEN
}
return 0;
}
long int multiplyNumbers(int n){
if (n>=1)
return n*multiplyNumbers(n-1);
else
return 1;
}