10) Answer: Option d) one of the above
Explanation:
Program:
#include<stdio.h>
int main()
{
int n = 0;
for(n=7; n<0; n--)
{
printf("*****\n");
n =2*n;
}
printf("n = *%d", n);
return 0;
}
Output:
11) Answer: Option d) one of the above
Explanation:
Program:
#include<stdio.h>
void fun (int);
int main()
{
fun(3);
return 0;
}
void fun (int a)
{
int x =10;
while(a != 3 || x > 5)
{
a = a + 5;
if ( a < 7 )
{
printf ("%d\n",a);
continue;
}
}
}
Output:
12) Answer: Option d) one of the above
Explanation:
Program:
#include<stdio.h>
int main()
{
int n=3;
while(n>1)
{
if(n<=7)
break;
printf("%d\n", n);
}
return 0;
}
Output: // It does not print any thing
10 What does the last printf in this code print to the screen? a)n-7 b)n- 0...
7 - What does the code print to the screen? float x(float) 7/3; printf ( " % .2 f", x); a) 7/3 b) 2.50 c) 2.00 d) None of the above a) TRUE b) FALSE c) TRUEFALSE d) None of the above 8 - What does the code print to the screen? int x3; if (x >31x!-2 printf ("TURE") printf ("FALSE"); 9What does the code print to the screen? a) TRUETRUE b) TRUE c) TRUETRUETRUE d) TRUETRUETRUETRUE e) None of...
#include <stdio.h> void printHelp () { printf ("\n"); printf ("a: a(x) = x*x\n"); printf ("b: b(x) = x*x*x\n"); printf ("c: c(x) = x^2 + 2*x + 7\n"); printf ("q: quit\n"); } void a(float x) { float v = x*x; printf (" a(%.2f) = %.2f^2 = %.2f\n", x, x, v); } // end function a void b(float x) { float v = x*x*x; printf (" a(%.2f) = %.2f^3 = %.2f\n", x, x, v); } // end function b void c(float x)...
C code Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat, including after the last. Ex: numRows = 2 and numColumns = 3 prints: 1A 1B 1C 2A 2B 2C #include <stdio.h> int main(void) { int numRows; int numColumns; int currentRow; int currentColumn; char currentColumnLetter; scanf("%d", &numRows); scanf("%d", &numColumns); /* Your solution goes here */ printf("\n"); return 0; }
Combine two codes (code 1) to get names with(code 2) to get info: Code 1: #include<unistd.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<dirent.h> #include<stdio.h> #include<stdlib.h> void do_ls(char []); int main(int argc,char *argv[]) { if(argc == 1) do_ls("."); else while(--argc){ printf("%s:\n",*++argv); do_ls(*argv); } } void do_ls(char dirname[]) { DIR *dir_ptr; struct dirent *direntp; if((dir_ptr = opendir(dirname)) == NULL) fprintf(stderr,"ls1:cannot open %s\n",dirname); else { while((direntp = readdir(dir_ptr)) != NULL) printf("%s\n",direntp->d_name); closedir(dir_ptr); } } ____________________________ code 2: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> void show_stat_info(char *,...
can u please solve it in c++ format,,,, general format which is #include<stdio.h> .......printf and scanf format dont worry about the answers i have down Q3, What is the output of the program shown below and explain why. #include #include <stdio.h> <string.h> int main(void) ( char str[ 39764 int N strlen(str) int nunj for (int i-0; i t Nǐ.de+ printf(") num (str[] 'e); I/ digits range in the ASCII code is 48-57 if (nue > e) f 9 printf( Xdin,...
/* • The following code consists of 5 parts. • Find the errors for each part and fix them. • Explain the errors using comments on top of each part. */ #include <stdio.h> #include <string.h> int main( ) { ////////////////////////////////////////////////////////////////////////// ////////////// Part A. (5 points) ////////////////// int g(void) { printf("%s", Inside function g\ n " ); int h(void) { printf(" % s ", Inside function h\ n "); } } printf("Part A: \n "); g(); printf(" \n"); ////////////////////////////////////////////////////////////////////////// ////////////// ...
i need flowchart for the following c code #include <stdio.h> int main() { int n, i, sum = 0; printf("Enter an integer: "); scanf("%d",&n); i = 1; while ( i <=n ) { sum += i; ++i; } printf("Sum = %d",sum); return 0; }
PART FOUR:(20 points) Predict the output that would be shown in the terminal window when the following program fragments are executed 1. Assume that an int variable takes 4 bytes and a char variable takes 1 byte #include<stdio.h> int main() int A[]-{10, 20, 30, 40); int *ptrl - A; int ptr2 = A +5; printf("The Resull: %d\n".(ptr2-ptrl)); printf("The Resul2: %d\n".(char*)ptr2-(char*)ptr); return 0; 2. What does the following program print? #include <stdio.h> int main(void) unsigned int x 1: unsigned int total...
What is the output of the following c program. Why, Can you tell me how do you solve it? #include <stdio.h> int fun(int n) { if(n==0) { return 1; } else return 7 + fun(n-2); } int main() { printf("%d", fun (4)); return 0; | }
PUT INTO PYTHON CODE #include <stdio.h> #include <float.h> int main(void) { float a = 1; float b = 0.5; float c = a + b; int bits = 0; while (c != a) { bits = bits + 1; b = b / 2; c = a + b; } printf("%d\n",bits); return 0; }