Write a program that prints the following lines on the screen
C++ is a High level Language
It is a language that uses Compiler as language translator
This is a case-sensitive language
It is used to solve computational problems of computer
For example 3+9=12
Write the following program in c++.
the project.
Combine your first and second name and pick ony the first five characters of your name for
i.Decare an array named name1 and put al the first five characters into it.
searched character in the array. Let the program be such that the user will input the
ii.Write a for loop with an if condition that will find and output the index value of a
character being searched for.
Write a Person class that has attributes of id, name and address. It has a constructor to initialize, a member function to input and a member function to display data members. Create second class Student that inherits Person class. It has additional data members of roll number and marks. It also has member functions to input and display its data members. Create another class Scholarship that inherits Students class. It has additional attributes of scholarship name and amount. It also has member functions to input and display its data members.
Dry Run the given code:
int num,r,sum=0,t;
cin >> num;
for(t=num; num!=0; num=num/10)
{
r=num % 10;
cout<<r<<endl;
sum=sum*10+r;
cout<<sum<<endl;
}
Dry Run the given code:
int num; cin>>num;
int t1 = 0;
int t2 = 1;
int newTerm;
for (int i= 1; i<=num ; i=i+1 ){
if(i==1){
cout << t1<< endl;
}
if (i==2){
cout << t2 << endl;
}
newTerm= t1 + t2;
t1= t2;
t2= newTerm;
}
5. Even Out
by CodeChum Admin
You know, I was lying when I said the last time that numbers associated with 3 are my favorite, because the one I actually like the most in the world are even numbers! But to make things harder for you, you have to pick the even numbers from a range of two given numbers. Ha!
Now, let's try this one more time!
Instructions:
Input two integers in one line, separated by a space. The first integer shall represent the starting point, and the other, the ending point.
Print out all even numbers that are within the range of the starting and ending point. Also keep in mind that the starting and ending numbers are also included in your even number evaluation!
Input
A line containing two integers separated by a space.
5·10
Output
A line containing integers separated by a space.
6·8·10
4. A Shorter Three
by CodeChum Admin
Numbers in threes are awesome! But the one last time was too lengthy to look at, so I just want to view it in a shorter but still readable format.
You okay with this task?
Instructions:
Print out all numbers from 1 to 100 that is divisible by 3 using a for loop just like the last problem, but this time, with each number only separated by the space like that of the sample output.
Output
A line containing integers divisible by 3 separated by a space.
3·6·9·12·15·18·21·24·27·30·33·36·39·42·45·48·51·54·57·60·63·66·69·72·75·78·81·84·87·90·93·96·99
3. There was a Three
by CodeChum Admin
I'm bored with just basic counting. How about we do some complex things this time? But I don't want to be associated with any number that's not divisible by 3.
Think you can handle this?
Instructions:
Print out all numbers from 1 to 100 that is divisible by 3, each in separate lines, using a for loop.
Output
Multiple lines containing an integer that is divisible by 3.
3
6
9
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
72
75
78
81
84
87
90
93
96
99
by CodeChum Admin
For those of you who may not now, a factorial is a product of multiplying from 1 until the number. Now, you must make a program that will accept an integer and then print out its factorial using loops.
Are you up for this task?
Instructions:
Input
A line containing an integer.
5Output
A line containing an integer.
1201. FizzBuzz
by CodeChum Admin
Let’s play a game of FizzBuzz! It’s quite the same with your childhood “PopCorn” game, but with a little bit of twist to align it with programming.
Are you ready?
Instructions:
Input a random positive integer in one line. This will serve as the ending point of your loop.
Using a for() loop, loop from 1 to the ending point (inclusive) and perform the following statements:
If the number is only divisible by 3, print "Fizz"
If the number is only divisible by 5, print "Buzz"
If the number is divisible by both 3 and 5, print "FizzBuzz"
If nothing is true in the previous conditions, skip the number
Input
A line containing an integer.
15
Output
Multiple lines containing a string.
Fizz
Buzz
Fizz
Fizz
Buzz
Fizz
FizzBuzz