top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a c program, to find the addition of last two numbers using functions?

0 votes
760 views
Write a c program, to find the addition of last two numbers using functions?
posted Oct 22, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Its a simple homework problem -

#include<stdio.h>

int main() {
   int num1, num2, res;

   printf("\nEnter the two numbers : ");
   scanf("%d %d", &num1, &num2);

   res = sum(num1, num2);

   printf("\nAddition of two number is : ");
   return (0);
}

int sum(int num1, int num2) {
   int num3;
   num3 = num1 + num2;
   return (num3);
}
answer Oct 23, 2017 by Salil Agrawal
Similar Questions
+2 votes

Rohit wants to add the last digits of two given numbers.
For example, If the given numbers are 267 and 154, the output should be 11.

Below is the explanation -
Last digit of the 267 is 7
Last digit of the 154 is 4
Sum of 7 and 4 = 11

Write a program to help Rohit achieve this for any given two numbers.

Note: The sign of the input numbers should be ignored. i.e.
if the input numbers are 267 and 154, the sum of last two digits should be 11
if the input numbers are 267 and -154, the sum of last two digits should be 11
if the input numbers are -267 and 154, the sum of last two digits should be 11
if the input numbers are -267 and -154, the sum of last two digits should be 11

+2 votes

Assumption:
The input strings will contain only numeric digits
The input strings can be of any large lengths
The lengths of the two input string need not be the same
The input strings will represent only positive numbers
Example

If input strings are “1234” and “56”, the output string should be “1290”
If input strings are “56” and “1234”, the output string should be “1290”
If input strings are “123456732128989543219” and “987612673489652”, the output string should be “123457719741663032871”

+7 votes

Can anybody suggest how can we create a program in C to know the last modification date of any file?

...