[org 0x0100]
; a=b+d
mov ax,[b]
add ax,[d]
mov [a],ax
mov ax,0x4c00
int 0x21
a : dw 0
b : dw 3
d : dw 9
Thursday, 27 September 2018
Tuesday, 3 July 2018
write a programm that prefrom postfix , prefix increment and decrement on a number
Write a program that preform postfix , prefix increment and decrement on a number
///////// solutions
#include <iostream>
using namespace std;
int main() {
int num=10;
cout<<"After the prefix increment"<<++num<<endl;
cout<<"Aftr the postfix increment"<<num++<<endl;
cout<<"After the prefix decrement"<<--num<<endl;
cout<<"Aftr the postfix decrement"<<num--<<endl;
}
a c++ program that preform all the mathematical operation on two numbers
Write a program that preform all the mathematical operation on two numbers that is taken from user
///////// solutions#include <iostream>
using namespace std;
int main() {
int n,m;
cout<<"Enter the First number"<<endl;
cin>>n;
cout<<"Enter the Second number"<<endl;
cin>>m;
cout<<"The sum is "<<n+m<<endl;
cout<<"The sum is "<<n-m<<endl;
cout<<"The sum is "<<n*m<<endl;
cout<<"The sum is "<<n/m<<endl;
cout<<"The sum is "<<n%m<<endl;
}
how to calculate the sum of all the numbers number is taken from the user
Write a program that calculate the sum of all the number that is entered by user
///////// solutions
#include <iostream>
using namespace std;
int main() {
int sum,n;
cout<<"Enter the number plase "<<endl;
cin>>n;
sum=(n*(n+1))/2;
cout<<"The sum is "<<sum<<endl;
}
how to calculat the sum of all number from 1 to 100
Write a program that calculate the sum of all the numbers from 1 to 100
///////// solutions
#include <iostream>
using namespace std;
int main() {
int sum;
sum=(100*101)/2;
cout<<"The sum is "<<sum<<endl;
}
how to convert sec into hour, min,sec in c++
Write a programm that take the time from user in second and
convert it into hour mintue and second
////////// solutions
#include <iostream>
using namespace std;
int main() {
int sec;
cout<<"Enter the time in seconds"<<endl;
cin>>sec;
int hour ,min;
hour=sec/3600;
sec%=3600;
min=sec/60;
sec%=60;
cout<<hour<<" : "<<min<<" : "<<sec<<endl;
project with solution in c++
Write a program that does the following:
a. Prompts the user to input five decimal numbers.
b. Prints the five decimal numbers.
c. Converts each decimal number to the nearest integer.
d. Adds the five integers.
e. Prints the sum and average of the five integers
////////////// Soltion //////////////////
#include <iostream>
using namespace std;
int main() {
//// a part
float a,b,c,d,e;
int sum=0;
cout<<"Enter th score of first number"<<endl;
cin>>a;
cout<<"Enter th score of second number"<<endl;
cin>>b;
cout<<"Enter th score of third number"<<endl;
cin>>c;
cout<<"Enter th score of forth number"<<endl;
cin>>d;
cout<<"Enter th score of fifth number"<<endl;
cin>>e;
// part b
cout<<"first number is "<<a<<endl;
cout<<"second number is "<<b<<endl;
cout<<"third number is "<<c<<endl;
cout<<"forth number is "<<d<<endl;
cout<<"fifth number is "<<e<<endl;
///////////// part c
a=int(a);
b=int(b);
c=int(c);
d=int(d);
e=int(e);
///// part d
sum=a+b+c+d+e;
//////// part e
cout<<"The sum is "<<sum<<endl;
cout<<"The average is "<<sum/5<<endl;
}
a. Prompts the user to input five decimal numbers.
b. Prints the five decimal numbers.
c. Converts each decimal number to the nearest integer.
d. Adds the five integers.
e. Prints the sum and average of the five integers
////////////// Soltion //////////////////
#include <iostream>
using namespace std;
int main() {
//// a part
float a,b,c,d,e;
int sum=0;
cout<<"Enter th score of first number"<<endl;
cin>>a;
cout<<"Enter th score of second number"<<endl;
cin>>b;
cout<<"Enter th score of third number"<<endl;
cin>>c;
cout<<"Enter th score of forth number"<<endl;
cin>>d;
cout<<"Enter th score of fifth number"<<endl;
cin>>e;
// part b
cout<<"first number is "<<a<<endl;
cout<<"second number is "<<b<<endl;
cout<<"third number is "<<c<<endl;
cout<<"forth number is "<<d<<endl;
cout<<"fifth number is "<<e<<endl;
///////////// part c
a=int(a);
b=int(b);
c=int(c);
d=int(d);
e=int(e);
///// part d
sum=a+b+c+d+e;
//////// part e
cout<<"The sum is "<<sum<<endl;
cout<<"The average is "<<sum/5<<endl;
}
c++ simple project of match
Write a program that prompts the user to input five decimal numbers. The
program should then add the five decimal numbers, convert the sum to the
nearest integer, and print the result.
solution :
#include <iostream>
using namespace std;
int main() {
float a,b,c,d,e;
int avg;
cout<<"Enter the score of first match"<<endl;
cin>>a;
cout<<"Enter the score of second match"<<endl;
cin>>b;
cout<<"Enter the score of third match"<<endl;
cin>>c;
cout<<"Enter the score of forth match"<<endl;
cin>>d;
cout<<"Enter the score of fifth match"<<endl;
cin>>e;
avg=(a+b+c+d+e)/(4+1);
cout<<"The average is "<<avg<<endl;
}
c++ full online course problems with solution
Write a program that prompts the user to enter five test scores and then prints
the average test score
/////////solutions:///////////////
#include <iostream>
using namespace std;
int main() {
float a,b,c,d,e;
float avg;
cout<<"Enter the score of first match"<<endl;
cin>>a;
cout<<"Enter the score of second match"<<endl;
cin>>b;
cout<<"Enter the score of third match"<<endl;
cin>>c;
cout<<"Enter the score of forth match"<<endl;
cin>>d;
cout<<"Enter the score of fifth match"<<endl;
cin>>e;
avg=(a+b+c+d+e)/(4+1);
cout<<"The average is "<<avg<<endl;
}
problems with solution in c++
Write a program that produces the following output:
**********************************
* Programming Assignment 1 *
* Computer Programming I *
* Author: ??? *
* Due Date: Thursday, Jan. 24 *
**********************************
**********************************
* Programming Assignment 1 *
* Computer Programming I *
* Author: ??? *
* Due Date: Thursday, Jan. 24 *
**********************************
solution
#include <iostream>
using namespace std;
int main() {
cout<<"**********************************"<<endl;
cout<<"* Programming Assignment 1 * "<<endl;
cout<<"* Computer Programming I *\n"<<endl;
cout<<"* Author: ??? *\n"<<endl;
cout<<"* Due Date: Thursday, Jan. 24 *\n"<<endl;
cout<<"**********************************"<<endl;
}
how to declare character type variable in c++
Write a program that store three values in character type of variables and display
solution
#include <iostream>using namespace std;
int main() {
char a='A', b='D', c='G';
cout<<a<<" "<<b<<" "<<c ;
return 0;
}
how to calculate the sum of floating point number in c++
Write a programm that store three values in floating type of variables and display it sum
solution
#include <iostream>using namespace std;
int main() {
float a=22.33, b=3.44, c= 44.44, sum;
sum =a+b+c;
cout<<"The sum is "<<sum;
return 0;
}
how to calculate the sum of three variables in c++
Write a programm that store three values in integer type of variables and display it sum
solution
#include <iostream>using namespace std;
int main() {
int a=22;
int b=33;
int c= 44;
int sum;
sum =a+b+c;
cout<<"The sum is "<<sum;
return 0;
}
Subscribe to:
Posts (Atom)