Computer Science, asked by Anonymous, 10 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
4

Answer:

here is your answer mate

Explanation:

answer 1:

1.Input a number from user. ...

2.To find last digit of given number we modulo

divide the given number by 10 . ...

3. To find first digit we divide the given number by 10 till num is greater than 0 .

4. Finally calculate sum of first and last digit i.e. sum = firstDigit + lastDigit .

answer 2:

The program output is shown below.

1.#include<iostream>

2.int num;

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

4.cin >> num;

5.if (num >= 0)

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

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

8.return 0;

hope it helps you

hope it helps you mark as brainliest

hope it helps you mark as brainliest follow me

now don't ask questions on this topic otherwise many people will report or spam you..ok..

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