Computer Science, asked by Anonymous, 7 months ago

1. Write a program in C++ to enter any 3 digit number and find the product of the first and the last digit.

2. Write a program in C++ to input any number and to find whither the number is positive or negative.

Please solve this C++ ​

Answers

Answered by Anonymous
13

Answer:

1 . Logic to find sum of first and last digit using loop

Logic to find sum of first and last digit using loopInput a number from user. ...

Logic to find sum of first and last digit using loopInput a number from user. ...To find last digit of given number we modulo divide the given number by 10 . ...

Logic to find sum of first and last digit using loopInput a number from user. ...To find last digit of given number we modulo divide the given number by 10 . ...To find first digit we divide the given number by 10 till num is greater than 0 .

Logic to find sum of first and last digit using loopInput a number from user. ...To find last digit of given number we modulo divide the given number by 10 . ...To find first digit we divide the given number by 10 till num is greater than 0 .Finally calculate sum of first and last digit i.e. sum = firstDigit + lastDigit .

2. #include<iostream>

int num;

cout << "Enter the number to be checked : ";

cin >> num;

if (num >= 0)

cout << num << " is a positive number.";

cout << num << " is a negative number.";

return 0;

Similar questions