Answer:
The program in C++ is as follows:
#include <iostream>
using namespace std;
int main(){
int qty;
float discount = 0;
cout<<"Quantity: ";
cin>>qty;
int cost = qty * 100;
{
; }
cout<<"Cost: "<<cost - discount;
return 0;
}
Explanation:
This declares the quantity as integer
int qty;
This declares and initializes discount to 0
float discount = 0;
This prompts the user for quantity
cout<<"Quantity: ";
This gets input for quantity
cin>>qty;
This calculates the cost
int cost = qty * 100;
If cost is above 1000, a discount of 10% is calculated
{
; }
This prints the cost
cout<<"Cost: "<<cost - discount;
Answer:
#read value of name
name=input("Enter name:")
#find and ptint the last character of the string
print("last character of string is:",name[-1])
Explanation:
Read a string from user and assign it to variable "name".Find its last character as "name[-1]". Since name is character array,so name[-1] will give the last character of the array.
Output:
Enter name:Smith
last character of string is: h
Answer:
When you need to keep the original document or send the document to multiple people.
Explanation:
If you need to keep the original document (eg. marriage documents or birth certificate or something important), you would make a copy of it (unless you are sending it to a lawyer or a government agency).
If you, for instance, have a memo for your company that all your employees need to read, you would copy the document so you would be able to print it and send it to everyone without passing the document one at a time.
C because you can’t graduate at 4 or 14 and if your kid is graduating when you’re 24 then that means you have birth at 7 years old which isn’t possible.