Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#define _CRT_SECURE_NO_WARNINGS #include #include int main() { int n, sum=0; printf(n= ); scanf(%d, &n); n = n > 0 ? n : -n; while (n
#define _CRT_SECURE_NO_WARNINGS
#include
#include
int main()
{
int n, sum=0;
printf("n= ");
scanf("%d", &n);
n = n > 0 ? n : -n;
while (n > 0) {
sum += n % 10;
n /= 10;
}
printf("%d", sum);
getchar(); getchar();
return 0;
}
write a c++ program for the following question
"random numbers"
Given an array dimension (n). Fill the array with random numbers in the range [ -100; 100]. Swap the values of zero and maximum of elements. To work with an array to use.
NB: the solution should be in the form as shown in an example below :
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started