if a five digit number is input through the keyboard, write
a program to calculate the sum of its digits.
(hint:-use the modulus operator.'%')
Answer Posted / k.kavitha
main()
{
int num=0,sum=0,k=0;
pirntf("enter the number\n");
scanf("%d",num);
while(num!=0);
{
k=num%10;
sum=sum+k;
num=num/10;
}
printf("%d",sum);
}
| Is This Answer Correct ? | 137 Yes | 90 No |
Post New Answer View All Answers
Why do we use stdio h and conio h?
What is the purpose of main() function?
Who is the main contributor in designing the c language after dennis ritchie?
Explain do array subscripts always start with zero?
What is the difference between functions getch() and getche()?
What is the difference between union and anonymous union?
What is #include stdio h and #include conio h?
Why can arithmetic operations not be performed on void pointers?
Write a program to swap two numbers without using the third variable?
Can a pointer be static?
regarding pointers concept
Write a program to maintain student’s record. Record should
not be available to any unauthorized user. There are three
(3) categories of users. Each user has its own type. It
depends upon user’s type that which kind of operations user
can perform. Their types and options are mentioned below:
1. Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record)
2. Super Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record, Delete Single Record)
3. Guest
(Search Record [by Reg. No or Name], View All Records)
When first time program runs, it asks to create accounts.
Each user type has only 1 account (which means that there
can be maximum 3 accounts). In account creation, following
options are required:
Login Name: <6-10 alphabets long, should be unique>
Password: <6-10 alphabets long, should not display
characters when user type>
Confirm Password:
What is a stream?
What is identifier in c?
How many types of errors are there in c language? Explain