Q&A Discussions
what is tjis code problem!
#include <iostream>
using namespace std;
int main()
{
int b = 5;
int arr[b] = {11, 35, 62, 555, 989};
int sum = 0;
for (int x = 0; x < 5; x++) {
sum += arr[x];
}
cout << sum << endl;
return 0;
}
I cannot make an array using int variable in order to define array's element number!?
1 Vote
7 Answershey guys, I've been trying to work out the formula 'v=I*r'. But whenever I run the program and input values for I and r, it doesn't give the right answer.
This is the code
#include <iostream>
using namespace std;
int main() {
int i,r;
int v = i*r;
cout<<"what is the value of i?\n";
cin>>i;
cout<<"what is the value of r?\n";
cin>>r;
cout<<"voltage ="<<v<<endl;
return 0;
}
p/s: I'm new to programming
1 Vote
8 AnswersWrite a program to return the area of Geometricshapes square and rectangle. Area of square is side*side, rectangle is length*breadth. The controlling class should display the following menu and respond to the user’s selection
Mean
1. Calculate area of square
2. Calculate area of rectangle
3. Quit
Enter your choice (1-3):
0 Votes
3 Answershello every one
it is a usefull advice in learning this html course , leave html5 at the bigining & learn java script completly because in some sections (from 10/19 to end of the course) you need basic & even advance knowledge of JS . then your able to return to previous course & learn html5 easier.
goodluck.
1 Vote
3 Answersif i text 21 it stacks. program says you are a child. you are a teenager. you are adult. how can i delete this "stack".
#include <iostream>
using namespace std;
int main() {
int age;
cin>>age;
if (age>=14){
cout<<"You're a Teenager"<<endl;
}
if (age>=18){
cout<<"You're adult"<<endl;
}
if (age>=0){
cout<<"You're a Child"<<endl;
}
else{
cout<<"Are u stupid ?"<<endl;
}
return 0;
}
0 Votes
4 Answers
what have i to do, if i want that the program always writes for example :
0+1
1+2
3+3
6+4
10+5
15+6
...
because now it just writes
1
3
6
10
15
...
and maybe if it works, can i make then
0+1=1
1+2=3
3+3=6
6+4=10
#include <iostream>
using namespace std;
int main(){
int i;
int sum = 0;
for (i = 1; i <= 100; i++){
sum = sum+i;
cout<<sum<<endl;
}
cout<<sum;
return 0;
}
1 Vote
5 AnswersWher is mistake?
0 Votes
5 Answersjava class Add quot;">"quot;
quot;;">"quot;;"awesome");"dolor""haha""hihi""hoho""huhu");"ipsum""is""sit"{}+=addadd("hehe"add("lorem"add("this"classconstructor(...words)newprint()returnthis.words 1 Vote
4 AnswersMatt reaches the final round of a treasure hunt. In this, he finds that as he proceeds there are flags with the number written on them at different positions. The difference between two consecutive flags can be either a or b. If he finds the number on the first flag is 0. Given three integer, first one is number of flags present, second is a and third is b. then return all the possible values for last flag for each test case.
hunt({3 1 2}) = {2 3 4}
0 Votes
2 Answers