please could anyone help me with this assigment!!!
which contains pointers and functions
BTW----> iam a biginner
here is the problem:
Write a complete C program to compute the least common divisor (LCD). The program should reverse and sum the digits of the given integers. Use the following functions with pointers:
Function Fun_1 to compute the least common divisor
Function Fun_2 to reverse and sum the digits of the given integer
Sample Run:
Enter Your Choice:
|1 – To Reverse and Sum the Digits
|2 - To compute LCD
|3- Exit
………………………………….
1
Input the given numbers
Num1: 123
Num2: 456
Reverse of Num1: 321
Sum of Num1 digits: 6
Reverse of Num2: 654
Sum of Num2 digits: 15
--------------------------------------------------------------------------------
i was able to find some codes, maybe it's usefull
this one for the sum
Code:
#include <stdio.h>
int main()
{
int x,y,
sum = 0;
printf("Enter the number \n");
scanf("%d",&x);
for (x!=0;y=x%10;x/=10)
sum =sum+ y;
{
printf("The sum is %d\n", sum);
}
return 0;
}
and this one for the inverse
Code:
#include<stdio.h>
main()
{
int num,
rev=0;
printf("\n Enter the number\n ");
scanf("%d", &num);
while(num>0)
{
rev = (rev * 10) + (num % 10);
num = num / 10;
}
printf("\n Reverse of the number is %d", rev);
return(0);
}
thanks...