Answer Posted / jay soni
#include<stdio.h>
#include<conio.h>
void main()
{
int n,sum=0,r;
printf("enter the value");
scanf("%d",&n);
while(n>0)
{
r=n%10;
n=n/10;
sum=sum+r;
}
printf("\nsum of digits is %d",sum);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is restrict keyword in c?
How do I determine whether a character is numeric, alphabetic, and so on?
What is class and object in c?
What does. int *x[](); means ?
Can we change the value of constant variable in c?
Explain the bubble sort algorithm.
Can one function call another?
Why is it usually a bad idea to use gets()? Suggest a workaround.
What is a buffer in c?
What is the usage of the pointer in c?
How to write a code for reverse of string without using string functions?
What are the disadvantages of c language?
What is build process in c?
What is #include stdlib h?
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: