diff options
Diffstat (limited to '45/CH16/EX16.6/example_16_6.sce')
-rwxr-xr-x | 45/CH16/EX16.6/example_16_6.sce | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/45/CH16/EX16.6/example_16_6.sce b/45/CH16/EX16.6/example_16_6.sce new file mode 100755 index 000000000..9b90c1c7d --- /dev/null +++ b/45/CH16/EX16.6/example_16_6.sce @@ -0,0 +1,11 @@ +//example 16.6
+lda= input('Enter the number of LDA instructions :'); // accepting the input from the user
+add= input('Enter the number of ADD instructions :');
+sub= input('Enter the number of SUB instructions :');
+sta= input('Enter the number of STA instructions :');
+shl= input('Enter the number of SHL instructions :');
+hlt= input('Enter the number of HLT instructions :');
+k= lda+add+sub+sta;
+l=shl+hlt;
+c= k*5 + l*4; // calculating the total no.of clck cycles required
+printf('Total clock cycles required to execute are = %d ',c); //displaying result.
\ No newline at end of file |