In this tutorial we’ll be learning some mathematical operations in C (multiplications, divisions , additions , subtractions , modulus) So let’s get started Almost all mathematical operations in C follow the following syntax :- Code: [number] [operator] [number] … The ‘…’ indicates that any number of terms (>2) can be operated in C. Addition Code: [Number] + [Number] Eg :- Code: 1 + 2 Subtraction :- Code: [Number] – [Number] Multiplication :- Code: [Number] * [Number] Division:- Code: [Number] / [Number] Modulus:- Code: [Number] % [Number] Tasks :- Now that we know how to carry Different mathematical operations in C, So let’s now use this knowledge to do mathematical tasks (I suggest the readers to try out first before seeing the solutions) 1. Make a C program to print the sum of 3 and 5 on to the screen. Code: #include<stdio.h> int main() { int sum = 3 + 5; printf("%d\n",sum); return(0); } 2. Make a C program to print out the product of 99 and 12345 on the screen Code: #include<stdio.h> int main() { int product = 99 * 12345; printf("%d\n",product); return(0); } 3. Make a C program to print out the difference of 88 and 77 on the screen. Code: #include<stdio.h> int main() { int difference = 88 - 77; printf("%d\n",difference); return(0); } I hope you liked this tutorial , Stay tuned for more
C provides us a Set of Functions for dealing with under roots , squares , cubes etc. We'll deal with that in the later tutorials