Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Arithmetic-Integer/C/arithmetic-integer.c
Normal file
17
Task/Arithmetic-Integer/C/arithmetic-integer.c
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int a, b;
|
||||
if (argc < 3) exit(1);
|
||||
b = atoi(argv[--argc]);
|
||||
if (b == 0) exit(2);
|
||||
a = atoi(argv[--argc]);
|
||||
printf("a+b = %d\n", a+b);
|
||||
printf("a-b = %d\n", a-b);
|
||||
printf("a*b = %d\n", a*b);
|
||||
printf("a/b = %d\n", a/b); /* truncates towards 0 (in C99) */
|
||||
printf("a%%b = %d\n", a%b); /* same sign as first operand (in C99) */
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue