اکی درستش کردم کدی که داری یه سری مشکلات داشت
int main()
{
long int x;
int n;
int sum=0;
printf("Enter a number:\n");
scanf("%d",&x);
while(x>=1)
{
sum+=x%10;
x/=10;
}
printf("Sum of digits");
printf("%d",sum);
getch();
}
بفرمایید کد من عین بلبل کار میکنه :)
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
int n=1;
int j=0;
printf("plz enter a number !");
scanf("%d",&n);
do
{
n = (n/10);
j = j++;
}
while( n!=0 );
printf("%d",j)...
ممنون یه خرده پیچیدست
من خودم کد رو به یه صورت دیگه سعی ردم بنویسم میخواستم بدونم ایراد این کد چیه؟
این کد رو نشستم نوشتم
خیر سرم خواستم یه الگوریتم از خودم بسازم!!!
به نظر خودم درسته اما چرا کار نمیکنه؟کجاش اشتباست؟
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{...
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int n;
int n1;
printf("plz enter a number !");
scanf("%d",&n);
do
{
n1 = (n % 10);
printf("%d",n1);
}
while(n1!=0);
getch();
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
int n1;
printf("plz enter a number !");
scanf("%d",&n);
printf("this number consists of these digits:");
do
{
n1 = (n % 10);
printf("%d",n1);
}
while(n1!=0);
getch();
return 0...