summaryrefslogtreecommitdiff
path: root/Numerical_Methods_by_E_Balaguruswamy/CH3/EX3.12/Ex3_12.R
diff options
context:
space:
mode:
Diffstat (limited to 'Numerical_Methods_by_E_Balaguruswamy/CH3/EX3.12/Ex3_12.R')
-rw-r--r--Numerical_Methods_by_E_Balaguruswamy/CH3/EX3.12/Ex3_12.R18
1 files changed, 18 insertions, 0 deletions
diff --git a/Numerical_Methods_by_E_Balaguruswamy/CH3/EX3.12/Ex3_12.R b/Numerical_Methods_by_E_Balaguruswamy/CH3/EX3.12/Ex3_12.R
new file mode 100644
index 00000000..90b861a7
--- /dev/null
+++ b/Numerical_Methods_by_E_Balaguruswamy/CH3/EX3.12/Ex3_12.R
@@ -0,0 +1,18 @@
+# Example 12 Chapter 3 Page no.: 53
+# Aritmetic rule
+
+cat(" Let a=5,b=7 and c=3")
+
+a=5
+b=7
+c=3
+
+k <- (a+b)/c
+j <- as.integer(a/c)+as.integer(b/c)
+
+if(k != j){
+ cat("(a+b)/c =",k,"\nWhich is not equal to (a/c)+(b/c)=",j)
+ cat(". \nThus, this Arithmetic rule fails.")
+}else{
+ cat("Both the results are same")
+} \ No newline at end of file