mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 13:31:21 +03:00
using long long int for pritf compatibility
This commit is contained in:
parent
1d8d07efc9
commit
de027fe4ff
@ -1,13 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int64_t get_product(FILE *fp, long start_pos, int num_digits)
|
||||
long long int get_product(FILE *fp, long start_pos, int num_digits)
|
||||
{
|
||||
char ch = ' '; /* temporary variable to store character read from file */
|
||||
uint8_t num = 0; /* temporary variable to store digit read */
|
||||
int64_t prod = 1; /* product accumulator */
|
||||
int count = 0; /* we use this variable to count number of bytes of file read */
|
||||
char ch = ' '; /* temporary variable to store character read from file */
|
||||
uint8_t num = 0; /* temporary variable to store digit read */
|
||||
long long int prod = 1; /* product accumulator */
|
||||
int count = 0; /* we use this variable to count number of bytes of file read */
|
||||
|
||||
/* accumulate product for num_digits */
|
||||
for (int i = 0; i < num_digits; i++, count++)
|
||||
@ -49,7 +48,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int position = 0;
|
||||
int num_digits = 4;
|
||||
int64_t prod, max_prod = 0;
|
||||
long long int prod, max_prod = 0;
|
||||
|
||||
/* if second command-line argument is ge=iven,
|
||||
* use it as the number of digits to compute
|
||||
|
Loading…
Reference in New Issue
Block a user