Nested If-else Problem Question using C++
Q1. write a program in C++ which prints the larger number. your program should take 3 integer numbers from the user and print the largest number on the console?
Example:
a=10 b=20 c=50
the larger number is c=50
Q2. write a program in C++ which prints get the car if a person has more than 1000 rupes, willing to purchase it and the color code of the car is 3344?
hint: willing can be taken as a single character as Y or y and N or n.
Q3. write a program in C++ which prints yes if the sum of two numbers is greater than 10 and numbers are odd numbers?
for help:
Submission Link:
Question # 1
ReplyDelete#include
using namespace std;
void main()
{
int a,b,c;
cout<<"Enter First Value = "<>a;
cout<<"Enter SEcond Value = "<>b;
cout<<"Enter Third Value = "<>c;
if(a>b&&a>c)
{
cout<<"Greater Number is = "<a&&b>c)
{
cout<<"Greater Number is = "<
using namespace std;
void main()
{
int r,cc;
char w;
cout<<"How Much Rupees You Have = "<>r;
cout<<"Do you want to purchase the car ? "<>w;
cout<<"Enter Colour Code of the Car = "<>cc;
if(r>=1000)
{
if(w=='y'||w=='Y')
{
if(cc==3344)
{
cout<<"Get the Car"<
using namespace std;
void main()
{
int a,b,sum;
cout<<"Enter First Number = "<>a;
cout<<"Enter Second Number = "<>b;
sum=a+b;
if(sum>10)
{
if(sum%2==1)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
}
system("pause");
}
Muhammad Bilal
S/O Rana Aurangzaib
Section A2
Cms # 406670
Question # 1
ReplyDelete#include
using namespace std;
void main()
{
int a,b,c;
cout<<"Enter First Value = "<>a;
cout<<"Enter SEcond Value = "<>b;
cout<<"Enter Third Value = "<>c;
if(a>b&&a>c)
{
cout<<"Greater Number is = "<a&&b>c)
{
cout<<"Greater Number is = "<<b<<endl;
}
else
{
cout<<"Greater Number is = "<<c<<endl;
}
system("pause");
}
Muhammad Bilal
Section A2
CMS # 406670
Question # 2
ReplyDelete#include
using namespace std;
void main()
{
int r,cc;
char w;
cout<<"How Much Rupees You Have = "<>r;
cout<<"Do you want to purchase the car ? "<>w;
cout<<"Enter Colour Code of the Car = "<>cc;
if(r>=1000)
{
if(w=='y'||w=='Y')
{
if(cc==3344)
{
cout<<"Get the Car"<<endl;
}
else
{
cout<<"You are'nt able to purchase the car!!!"<<endl;;
}
}
}
system("pause");
}
Muhammad Bilal
Section A2
CMS # 406670
Question # 3
ReplyDelete#include
using namespace std;
void main()
{
int a,b,sum;
cout<<"Enter First Number = "<>a;
cout<<"Enter Second Number = "<>b;
sum=a+b;
if(sum>10)
{
if(sum%2==1)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
}
system("pause");
}
Muhammad Bilal
Section A2
CMS # 406670
Name: Ahsan Waheed
ReplyDeleteSection : A bscs
406147 cms no
Q#1,
#include
Using namespace std;
Int main()
{
Int a=0;
Int b=0;
Int c=0;
Cout<<”enter your number”<>a>>b>>c;
If ( a>b&&a>c)
Cout<<”a is greatest”<a&&b>c)
Cout<<”b is greatest”<
Using namespace std;
Int main()
{
Int price=19900;
Cout<<”enter your price”<>price;
If (price>1000)
Cout<<”buy car”<
Using namespace std;
Int main()
{
Char a=0;
Cout<<”enter your number”<>a;
If ( a>=65 && a<=87)
Cout<<” character is entered”<=0 &&a<=9)
Cout<<”digit is entered”<<endl;
System(“pause”);
Return 0;
}
QUESTION NO:1
ReplyDelete#include
using namespace std;
int main()
{
int a;
int b;
int c;
cout<<"enter greater number"<>a>>b>>c;
if ((a>b)&&(a>c))
{
cout<<" "<
using namespace std;
void main()
{
int n;
int p;
char y;
cout<<"DO you want to purchase it"<=1000)
{
if(y=='x'||y=='X')
{
if(p==3344)
{
cout<<"Get the car"<
using namespace std;
int main()
{
int a,b,sum;
cout<<"enter a"<>a;
cout<<"enter b"<>b;
sum=a+b;
if(a+b>10)
{
cout<<"yes"<<endl;
}
else
{
cout<<"no"<<endl;
}
system ("pause");
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
QUESTION NO:1
ReplyDelete#include
using namespace std;
int main()
{
int a;
int b;
int c;
cout<<"enter greater number"<>a>>b>>c;
if ((a>b)&&(a>c))
{
cout<<" "<<endl;
}
else
{
cout<<" "<<endl;
}
system ("pause");
return 0;
}
BSCS SEC(A)
Question No 2;
ReplyDelete#include
using namespace std;
void main()
{
int n;
int p;
char y;
cout<<"DO you want to purchase it"<=1000)
{
if(y=='x'||y=='X')
{
if(p==3344)
{
cout<<"Get the car"<<endl;
}
else
{
cout<<"your are not able to purchase it!!!"<<endl;
}
}
}
system ("pause");
}
BSCS(A)
ReplyDeleteQuestion No 3;
#include
using namespace std;
int main()
{
int a,b,sum;
cout<<"enter a"<>a;
cout<<"enter b"<>b;
sum=a+b;
if(a+b>10)
{
cout<<"yes"<<endl;
}
else
{
cout<<"no"<<endl;
}
system ("pause");
}
BSCS(A)
#include
ReplyDeleteusing namespace std;
int main()
{
float n1,n2,n3;
cout<<"enter three numbers";
cin>>n1>>n2>>n3;
if(n1 >=n2 && n1>=n3)
{ cout<< "largest number"<= n1 && n2>=n3)
{cout<<"largest number"<=n1 && n3>=n2)
{cout<<"largest number"<<n3;
}
system ("pause");
return 0;
}
#include
ReplyDeleteusing namespace std ;
int main()
{
int price=10001;
cout<<"enter ur prize"<>"prize";
if(10001>1000)
{cout<<"buy a car"<<endl;
}
else{
cout<<"no enough money."<<endl;
}
system("pause");
return 0;
Question # 3
ReplyDelete#include
using namespace std;
void main()
{
int a,b,sum;
cout<<"Enter First Number = "<>a;
cout<<"Enter Second Number = "<>b;
sum=a+b;
if(sum>10)
{
if(sum%2==1)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
}
system("pause"
Post a Comment