You are on page 1of 1

Math in c programming printf(“This loli is finally legal”);

Multiplicative and additive operators }

+ (addition) if (age < 18) {

- (subtraction) printf(“This loli is illegal”);

* (multiplication) }

/ (division)

% (modulus)

Always follow pmdas pattern

Ex:

Int a=11 ,b=2;

float modulus;

modulus=a % b;

printf(‘product = %f”,modulus);

return 0;

if-then statement in c programming

if (/* condition goes here*/) {

/* if the condition is non zero (true), this code


will execute */ }

Ex:

Int main ()

int age;

printf (“Please enter age the age”);

scanf(“%d”,&age);

if (age > 18) {

printf(“This loli is legal”);

if (age == 18) {

You might also like