Write a c-programe that input one number of four digits and find digits sum?
Answers were Sorted based on User's Feedback
Answer / erdem
{
int num, sum ;
printf("Enter digit 1\n");
scanf("%d",num);
sum=sum+num;
for(i=1;i<4;i++)
{
printf("Enter digit %d\n",i);
scanf("%d",num);
sum=sum+num;
}
printf("the sum of digits is %d",sum);
getche();
Is This Answer Correct ? | 6 Yes | 1 No |
{
int sum,digit1,digit2,digit3,digit4;
printf("enter the four digit number\n");
scanf("%d",digit1,digit2,digit3,digit4);
digit1=(digit1%1000)/10;
digit2=(digit2%1000)/10;
digit3=(digit3%1000)/10;
digit4=(digit4%1000)/10;
sum=digit1+digit2+digit3+digit4;
printf("the sum of digits is %d",sum);
return(0);
}
Is This Answer Correct ? | 1 Yes | 7 No |
char* f() return "hello:"; void main() {char *str=f(); }
which typw of errors ? & how to solve it ?
Display this kind of output on screen. 1 0 1 1 0 1 3. Display this kind of output on screen. 1 1 0 1 0 1 4. Display this kind of output on screen. 1 1 0 1 0 1 5.Display this kind of output on screen. 1 2 3 4 5 6 7 8 9 10
what is meant for variable not found?
write the value of x and y after execution of the statements: int x=19,y; y=x++ + ++x; x++; y++;
Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.
Write a c-programe that input one number of four digits and find digits sum?
errors are known as?
3 Answers EX, State Bank Of India SBI,
#include<>stdio.h> #include<>conio.h> { printf("hello"); void main() getch(); } what the out put of this program and why ......plz clear my answer
main() { char c; for(c='A';c<='Z';c++) getch(); }
void main() { int i=7; printf("N= %*d",i,i); }
difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?