🔥Chapter 2 Practice Set 🔥
Practise 1
#include <stdio.h>
int main()
{
// int a; b = 5; This is the Wrong way to declare.
int a, b = 5; // This is the right way to declare.
int v = 3 ^ 3; //This is valid but does not give the correct answer "^" it is XOR operator
char dt = '2';
int n = (3.0 / 8 - 2); //GCC compiler takes decimal numver as a double datatype
printf(" Value OF n = %f", n);
return 0;
}
Practise 2
#include <stdio.h>
int main()
{
int num;
printf("Enter the Number to chech it is divisible or not by 97 = ");
scanf("%d", &num);
printf("Result = %d", num % 97);
return 0;
}
Practise 3
#include <stdio.h>
int main()
{
int x = 2, y = 3, z = 3, k = 1;
int result = 3 * x / y - z + k; //This is done by Operator Presedence and by associative law of operator which left to right
//3 * 2 / 3 - 3 + 1
//6 / 3 - 3 + 1
//2 - 3 + 1
//0
printf(" Returning the Result = %d", result);
return 0;
}
Comments
Post a Comment