write a program to gat the digt sum of a number (et. 15=
>1+5=6)
Answers were Sorted based on User's Feedback
Answer / sagarsp2010
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0,no;
clrscr();
printf("ENTER THE NO. OF TERMS:");
scanf("%d",&n);
for (i=1;i<=5;i++)
{
no=n%10;
sum=sum+no;
n=n/10;
}
printf("sum=%d",sum);
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / santhosh kumar
#include<stdio.h>
#include<string.h>
int main ()
{
char no[100];
char num[2];
int i;
int length = 0;
int sum = 0;
memset(num, 0, 2);
printf("Enter the number: ");
gets(no);
length = strlen(no);
for(i=0; i<length; i++)
{
num[0] = no[i];
sum += atoi(num);
}
printf("Sum = %d", sum);
return 0;
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Write a code to reverse string seperated by spaces i/p str=India is my country o/p str=aidnI si ym yrtnuoc After writing code, optimize the code
How important is structure in life?
write a program to check whether a given integer is a strong number or not? [Hint: 145=1!+4!+5! =1+24+120 =145]
What are the 3 types of structures?
Explain 'bus error'?
What compilation do?
7 Answers Geometric Software, Infosys,
Why do we use namespace feature?
In which layer of the network datastructure format change is done
In CMM or CMMI certified organizations,we assess only the standard software processes of the organization. We do not assess the organizations other functional departments like HR or Admin. Then how can we certify the entire organization as CMM level company?? We have assessed only software related activities. Right. There is no relation with other departments like Accounts, HR or Admin. Then how can we claim that the whole company is a CMM certified company?
21. #define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }
what is the difference between #include<stdio.h> and #include "stdio.h" ?
What is #include stdio h and #include conio h?