computer

posted by .

Which of the following does not print the numbers from I to 10?
A) maino

int i;


while (i<=10)

printf("%d\n", i); j++;



B) main()

int i;

i=O; do

Printf("%d\n". ++i), while (i<10);

C) maino

int i; for (i=l ; i<=1 0; i++) printf("%d\n", i); I D) maino

int i;

i=O; do I printf("%d\n", ++i); while (i<=10);
69) char sl [] = 1"rhis is a string"; char s2a = "pqrs";

Identify the code snippet which returns the first location in the String sl where any character from the
String s2 occurs

Output:

Searching for one of "pqrs" in the string '7his is a string" Located in position:3 A) for (i=O s2[ij !=AO', i++) for 0 = 0; ~1 U1 1=AO, if (s2[ij = sl Uj) ( if (POS = ‑111 j < p0s)
pos = j;
B) for (i=O; s2fi] !=AO'; i++) for 0 = 0; sl Ul !=AO'; j++) if (s2[ij s 1 Uj) ( if (Pos ‑111 j < pos) POS = j;
C) for(i=Qs2[ij!='O';i++){ for 0 = 0; S' U1 !=V: j++) if (s2li] sl Uj) ( if (Pos ‑111 j < pos) pos = j;
D) for (i=O; s2fil 1= W; I++) for a = 0; slUl !=AO'; j++) if (s2[ij sl U]) ( if (pos 111 j < pos) pos = j. I



70) What could be the output of the following program? ffinclude < stdio.h > maino struct r

char city[10]; Int pin;

static struct r p =("mysore",20); static char nj] ="bangalore"; FILE *fp; fp= fopen("TRLAL",wb");

  • computer programming -

    Assistance needed.

  • computer -

    First, if you post coding question, you will need to specify the language you're using. Many modern languages use similar syntax (C++ family).

    Second, Java has the same "compiler" on all platforms, while C++ has many implementation dependencies, depending on the platform and the compiler. So for C++ questions, the compiler and platform (machine type) should also be specified.

    Example: (first question)

    int i;
    while (i<=10)
    printf("%d\n", i); j++;

    The value if i had not been initialized. Java and some compilers may condone this, but many C/C++ compilers do not, and give rise to run-time errors or variable results.

    Finally, coding is a very precise activity. Any omission of a period (.) or a semi-colon could make a big difference, not to mention the wrong character.

    The sight of code like:

    "maino
    int i; for (i=l ; i<=1 0; i++) printf("%d\n", i); I D) maino "

    does not make it worthwhile to spend time looking at the code.

    If you want your code looked at seriously, you would have to treat your code the same way.

    Alternatively, you could consider posting a link to a scanned page to avoid copying code, which is an error-prone activity.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. C programming

    Enter two integers between 1 to 10 3 4 Both numbers are less than 5. The sum of two numbers is:-1081825676 The product of two numbers is:-1081825680 why are the sum and product so weird?
  2. C Programming

    I am trying to find the sum of two integers. I entered the following program into the Visual Studio and it is telling me that there are errors. Can someone tell me where they are please?
  3. c++ program

    how can a modfiy this source code to a menu. #include <stdio.h> #include <stdlib.h> #include <time.h> main() { char cYesNo = '\0'; int iResp1 = 0; int iResp2 = 0; int iResp3 = 0; int iElaspedTime = 0; int iCurrentTime …
  4. computer sciece

    #include <stdio.h> #include <stdlib.h> int main() { int num[100]={0}; int i,n=0; for(i=0; num[i] != EOF ; i++,n++) { scanf("%d",&num[i]); } printf("%d\n", i); while(i=0;i<n;i++) printf("%d ",num[i]); printf("\n"); system("pause"); …
  5. computer

    If int main() { int a=1; int *p; how do the following statements differ 1) p=&a; 2) *p=&a; 3) p=a; 4) printf("%d",p); 5) printf("%d",*p); and what does int **a mean
  6. Computer

    on C++, I want to make an operation like " 2x + y - z ", I wrote something like that but I can' t get the result, where is my mistake?
  7. C Programming

    Write a C program that accepts sales made by 5 sales reps for the 4 months that they have been selling the company's products. The program should then find the total sales for 4 months, total sales for each sales rep, and total sales …
  8. Programming

    #include<stdio.h> int main() { char ch; printf("Enter Your State Name : "); scanf("%c",&ch); if(ch == 'a') printf("Shipping Charge : $25"); else if(ch == 'b') printf("Shipping Charge : $50"); else if(ch == 'c') printf("Shipping …
  9. Programming

    #include<stdio.h> int main() { char ch; printf("Enter Your State Name : "); scanf("%c",&ch); if(ch == 'a') printf("Shipping Charge : $25"); else if(ch == 'b') printf("Shipping Charge : $50"); else if(ch == 'c') printf("Shipping …
  10. C++ program

    #include<stdio.h> int main() { char ch; printf("Enter Your State Name : "); scanf("%c",&ch); if(ch == 'malacca') printf("Shipping Charge : $25"); else if(ch == 'pahang') printf("Shipping Charge : $50"); else if(ch == 'terengganu') …

More Similar Questions