Write a program using Visual Studio 2017 that accepts four (4) lines of input:
• The first line contains a float value in 4.2f format • The second line contains a char value
• The third line contains a 4-digit int value
• The fourth line contains a char value and then displays all of the input on a single line
Phone Number
Write a program that accepts a phone number of the form +1(xxx)-xxxxxxx where x is a digit, and displays the sum of all digits (x's) in the phone number.
SUBMIT BOTH PIECES IN ONE FILE LAB2.C
Please find both the pieces in C program below:-
#include<stdio.h>
#include<conio.h>
void displaySum(char phone[]){
int n1 = phone[3] - '0';
int n2 = phone[4] - '0';
int n3 = phone[5] - '0';
int n4 = phone[8] - '0';
int n5 = phone[9] - '0';
int n6 = phone[10] - '0';
int n7 = phone[11] - '0';
int n8 = phone[12] - '0';
int n9 = phone[13] - '0';
int n10 = phone[14] - '0';
int sum = n1 + n2+n3+n4+n5+n6+n7+n8+n9+n10;
printf("sum of all digits (x's) in the phone number: %d\n", sum);
}
int main(int argc, char* argv[]){
system("cls");
char phone[20];
float f1 = 4.2f;
char c1 = 'A';
int i = 1234;
char c2 = 'Z';
printf("\n%.2f %c %d %c", f1, c1, i, c2);
printf("\nEnter Mobile Number in the format(+1(xxx)-xxxxxxx): ");
scanf("%s", &phone);
displaySum(phone);
system("PAUSE");
return 0;
}
The output is attached below:-

Please let me know in case of any clarifications required. Thanks!
Write a program using Visual Studio 2017 that accepts four (4) lines of input: • The...
Write a C program that accepts a phone number of the form +1(xxx)-xxx-xxxx where x is a digit, and displays the sum of all digits in the phone number.
Write an encryption and decryption program that displays properly in Microsoft Visual Studio using c++. Encrypt each digit by adding 7 and taking the remainder after division by 10. After encrypting each digit, swap the first and third then swap the second and fourth. Decryption should reverse the process. Program must input a single integer. Program must do encode and decode in one file. Example Program Session (yours must look like this): Encode (1) Decode (2): 1 Enter...
Create a program using Visual Studio 2017 called dataExercise.c that declares the following variables and displays their values: 1. Declare a character variable with value 'a', and display the character using printf with a %c format. Then add a second printf that displays the character with a %d format. 2. Declare a short int variable with a value set to the maximum value of a short int (the maximum value for whatever machine I happen to use to grade your...
Using Visual Studio 2017 Create This Program Using C# implement source code Program 5: The concept of a 5-digit palindrome number is a 5-digit number that reads the same from left to right and from right to left. For example, 12121, 45454, and 14741 are valid 5-digit palindrome numbers. Design (pseudocode) and implement (source code) a program (name it FiveDigitPalindrom) that reads a 5-digit number from the user (as integer value, not string) and then mathematically (using division and remainder...
Write a C++ program IN VISUAL STUDIO CODE that will display the value and logical address of an uninitialized float array with size twenty (20) and a reference pointing to the array.
in a c++ visual studio 2017 ...Write a program that simulates a lottery. The program should have an array of five integers named lottery and should generate a random number in the range 0 through 9 for each element in the array. The user should enter five digits, which should be stored in an integer array named user. The program is to compare the corresponding element in the two arrays and keep a count of the digits that match. For...
Write a program in Python to solve the following task: In this project, you will build a phone number from digits entered by your user. Your program will loop until 10 valid digits have been entered. It will then use those digits to display the phone number entered using the format: XXXXXXXXXX (or (XXX) XXX – XXXX for extra credit). The program will ask for a digit, it will check to see if the digit is actually between 0 and...
In c++ visual studio
Write a program that does the following: Reads the input data set from file named "data.txt". Assume that the input file contains x and y values as shown in the sample to the right (the first number in each line is the x value). The number of data points in the input file is not known but assume that they will not exceed 100. Once it gets the data in two one-dimensional arrays (x and y),...
This program should be run on Visual Studio. Please use printf
and scanf as input and output. Thank you
6.11 Lab Exercise Ch.6a: Functions: String analyzer Create and debug this program in Visual Studio. Upload your Source.cpp file for testing (1) Prompt the user to enter a string of their choosing. Output the string. (1 pt) Ex: ics Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have...
Create a C# program using WINDOWS FORM App in Visual Studio. THE ANSWER MUST BE IN C#, IN WINDOW FORM APP, IN VISUAL STUDIOS. Write the code to: Write a method called MaximumDiffrence that accepts an integer array as a parameter and return the maximum difference between adjacent values in the array, where the gap is defined as the absolute value of the difference between the 2 adjacent values. Example: if the array contains {5, 7, 4, 9, 6, 12,...