اكتب برنامج C لحساب مجموع عددين صحيحين وحساب عدد الأرقام من قيمة المجموع
- برمجة
- برمجة سي c
- 2021-05-03
- Wassim
الأجوبة
/*Write a C program to calculate the sum of two given integers and count the number of digits of the sum value*/
#include <stdio.h>
int main()
{
int x, y, sum_val, ctr;
printf("Input two integer values:\n");
scanf("%d %d", &x, &y);
ctr=0;
sum_val=x+y;
while(sum_val!=0){
if(sum_val>0){
sum_val=sum_val/10;
}
ctr++;
}
printf("\nNumber of digits of the sum value of the said numbers:\n");
printf("%d\n", ctr);
return 0;
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال