In: Computer Science
Write a code in two ways to generate all multiple of n: from 0
to 158 included. (this is all the teacher gave me)
1) in procedural style,
2) in Object Oriented style
Input: just a value of n between 11 and 19 included.
Output : the generated list required.
Choose any languages you know.
Keep working hard
-----------------
To do:
1- Read about Styles of PLs :
Procedural Programming Language. ...
Object-oriented Programming Language. ...
Functional Programming Language. ...
Logic Programming Language. ...
Scripting Programming Language. ...
2- Read about these PLs :
C Language. ...
C++ Language. ...
java Language. ...
Python Language. ...
3- Read OOP terminology(or paradigm), prepare yourself to explain them in convincing ways:
data abstraction
encapsulation
messaging
modularity
polymorphism
inheritance
Procedural Style C++ code:
#include<iostream>
using namespace std;
//function to print multiples
void printMultiples(int n){
for(int i=0;i<=158;i++){
cout<<n*i<<endl;
}
}
int main(){
int n;
//Enter Value of n
cin>>n;
// call function to print multiples
printMultiples(n);
return 0;
}
Please refer to the screenshot of the code to understand the indentation of the code
First few lines of Output:
Hope this helped. Please do upvote and if there are any queries please ask in comments section.