Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Exercise A:
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- for (int i = 0; i < 3; i++) {
- cout <<"**********\n";
- }
- return 0;
- }
- //end=========================================================
- Exercise B:
- //start=======================================================
- #include <iostream>
- using namespace std;
- int leafHeight = 6;
- int thunkHeight = 3;
- void createSpace(int line){
- for(int temp = 0;temp < leafHeight - line;temp++){
- cout << " ";
- }
- }
- void createDot(int line){
- for(int temp = 0;temp < line - 1;temp++){
- cout << "*";
- }
- }
- int main()
- {
- for(int step = 1;step <= leafHeight;step++){
- cout << "|";
- createSpace(step);
- createDot(step);
- cout << "*";
- createDot(step);
- createSpace(step);
- cout << "|\n";
- }
- for(int step = 1;step <= thunkHeight;step++){
- cout << "|";
- createSpace(1);
- createDot(1);
- cout << "*";
- createDot(1);
- createSpace(1);
- cout << "|\n";
- }
- return 0;
- }
- //end=========================================================
- Exercise C:
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "2468 + 1234 = " << 2468 + 1234 << "\n";
- cout << "2468 - 1234 = " << 2468 - 1234 << "\n";
- cout << "2468 * 1234 = " << 2468 * 1234 << "\n";
- cout << "2468 // 1234 = " << 2468 / 1234 << "\n";
- return 0;
- }
- //end=========================================================
- Exercise D:
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "DT = " << (7.8 * 6.4) << "\n";
- cout << "CV = " << (7.8 + 6.4)*2 << "\n";
- return 0;
- }
- //end=========================================================
- Exercise E:
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- cout << n*3;
- return 0;
- }
- //end=========================================================
- Exercise F: sai clg
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- int x, y, z;
- cin >> x >> y >> z;
- cout << (5*x + 3*y) * z;
- return 0;
- }
- //end=========================================================
- Exercise G: sai clgt
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- cout << n*n - n +1;
- return 0;
- }
- //end=========================================================
- Exercise H:
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- cout << to_string(n)[0] << "\n";
- cout << to_string(n)[1] << "\n";
- cout << to_string(n)[2] << "\n";
- return 0;
- }
- //end=========================================================
- Exercise I:
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- int x,y,z;
- cin >> x;
- cin >> y;
- cin >> z;
- cout << to_string(x)+":"+to_string(y)+":"+to_string(z);
- return 0;
- }
- //end=========================================================
- Exercise J:
- //start=======================================================
- #include <iostream>
- using namespace std;
- int main()
- {
- int h, m, s, x;
- cin >> h >> m >> s >> x;
- int total_sec = h*60*60 + m*60 +s +x;
- int minutes = (total_sec / 60);
- int hours = (minutes / 60)%12;
- if(hours == 0){
- hours == 12;
- }
- cout << to_string(hours) +" "+ to_string(minutes%60) +" " + to_string(total_sec%60) << endl;
- return 0;
- }
- //end=========================================================
- K:
- #include <stdio.h>
- int main()
- {
- unsigned long h,w,n;
- scanf("%lu%lu%lu",&h,&w,&n);
- unsigned long result = 0;
- for(unsigned long column = 0;column < h;column = column + n){
- for(unsigned long row = 0;row < w;row = row + n){
- result++;
- }
- }
- printf("%lu",result);
- return 0;
- }
Add Comment
Please, Sign In to add comment