Shell Script:
#!/bin/bash
#Bash Script that reads one number in one format and changes into another format
#Reading phone number
echo "Enter Phone number [(999) 999-9999]: ";
read phoneNo;
#Removing '('
temp="${phoneNo//(}"
phoneNo=$temp
#Removing ')'
temp="${phoneNo//)}"
phoneNo=$temp
#Removing '-'
temp="${phoneNo//-}"
phoneNo=$temp
#Forming new phone number
newPhoneNo=$(echo "${phoneNo:0:3}- ${phoneNo:4:3}-
${phoneNo:7:4}")
#Printing new phone number
echo "You entered: "$newPhoneNo
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Sample Output:
Write as a shell script Write as a shell script # include <stdio.h> int main (void)...
computers. 1. How many times will this loop repeat? include <stdlib.h> #include <stdio.h> void main(void) int 10 for(= 0; i < 101) printf("d", 1); A. 10 times B. 1 time C. It will run forever D. 0 times 2. What will be the output of this program? #include <stdlib.h> #include <stdio.h> int main() int a = 100, b = 200, C = 300; if(!a >= 500) b = 300; C = 400; printf("%d, 8d, &d", a, b, c); return 0;...
Solve using C programming 3. lf you are given this code. #include <stdio.h> int main() int var1, var2; int sum; printf("Enter number 1:\n "); scanf("%d",&var1); printf("Enter number 2:In ); scanf("%d",&var2); sum-var1+var2; printf ("Vnsum of two entered numbers : %d", //printf ("Output: %d", res); sum); return e; Modify this code by creating a function called "addition". Make the arguments of the functions numberl and number 2. Add the two values in the function. Return a value called "result". Print "result" in...
22. (6 points) Determine the output for the following coe # include < stdio.h > int main(void) ( int z 1, total -0, y printf(d , x) ) //end-for printf("The total %d\n", total) ) //end-main
QUESTION 12 What is the output of the following program? #include <stdio.h> int main(void) printf("From sealnto shininginC"); O a. From sea to shining O b. From sea to shining O c. From seanto shining nC O d. From sea to shining C
Question 3 Predict the output of the following C program: #include <stdio.h> void main() { int i = 0; for(; 1; i++){ printf("%d",i); if(i==7) break; } 12pt Paragraph 1 Β Ι Ο Αν και Ta
Draw the flowchart of the following program: # include < stdio.h> # include < math.h> int main (void) {double time, velocity, acceleration; print f("Enter new time value in second: \n"); scanf("% 1f", & time); if (time = = 1)} velocity = 0.5 * pow (time, 3); acceleration = 0.5* velocity * velocity;); if (time = = 0.5 * pow (time, 3); acceleration = .5 velocity * velocity;} else {velocity = 1.5 * pow (time, 3); acceleration = 1.5 * velocity...
6. Consider the following program: #include <stdio.h> main() { int a,b,c,d ; a=0; while (1) { printf("%d\n", a); printf("Input? "); scanf("%d",&c); if (c == 0) break; d=0; for (b=1; b<=c; b++) if (c%b == 0) d++; if (d == 2 11 C == 1) a=a+c; } } What does this program do? Rewrite the code, organizing it using sound principles. Include comments and redo variable names and indentation. Use multiple functions, blocks, and/or preprocessing if you deem it necessary.
please help me asap 1 Determine the output for the following code: #include<stdio.h> int main static int num; fornum : ++ num: num++) -- printf("%d". num): if num ==8) break; [10] COI retum 1 b) #include<stdio.h> int main int test: fortest - 0: tests=5: test); printer test: retum
1. What is the output of the following program? include <stdio.h> int wilma (int x) if (x<5) x = 7; return (x) int main (void) int x-1 x=wilma (x) ; printf ("%d", x); return (0) b)3 c) 4 d) 7 a) 1 e) none of these
main.c #include <stdio.h> int main() { Tong Tong int x = 1234567890000; char y = (char) x; printf("%d\n", y); Compile and run the above main.c file. a) Indicate the compiler command you would use to compile this program. Do any of the following flags affect the compilation? -Wall -Werror -pedantic -Woverflow b) Indicate any discrepancy between expected and actual behavior, and as a programmer, how to construct best practices to avoid this deviation. c) What happens if we do not...