I need help writing this program: Please use horzaontal and vertical spacing Usi
ID: 3624806 • Letter: I
Question
I need help writing this program: Please use horzaontal and vertical spacingUsing the sample program as an example, write a C program that will accept a string value from the keyboard.
Pass this value to a user defined function that will display each character in the string on a separate line of the screen.
Use variable names and a user function name that are meaningful. Be sure and include proper (comments).
#include
/*The function prototype: the function will accept two int values (name do not need to be provided here) and will return an int (the sum). */
int sum(int, int);
void main()
{
int myint1;
int myint2;
int result;
printf("Enter an integer: ");
scanf ("%d", &myint1);
printf("Enter a second integer: ");
scanf("%d", &myint2);
result = sum(myint1, myint2);
printf("The sum is %d. ", result);
return;
}
int sum (int val1, int val2)
{
int thissum;
thissum = val1 + val2;
return thissum;
}
Explanation / Answer
#include #include void mystring(char[]); int main() { char str1[100]; printf("Enter an string: "); scanf ("%s", &str1); mystring(str1); return 0; } void mystring(char str1[]) { int i, length; length = strlen(str1); for(i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.