Question

1. Describe an intrinsic function. Give an example. 2. Write the for loop with a print instruction to count to 100 by 2

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) Intrinsic function is similar to an inline function where the compiler substitutes the function call with set of instructions. This is done to increase the performance. These functions are generally used a lot in coding hence they are provided by the compiler. They are not written in any code or in any library. You can call these function without using the "#include".

Ex: strcat - To concatenate strings, strcmp - To compare strings, strcpy - To copy one string to another, strlen - To get the length of the string

2) int i=0; //Declare loop index

for(i = 2 ; i <= 100 ; i+=2){ //For loop

//for every iteration we increment the index by 2

printf("%d\n", i); //print stratement

}

Sample Output:

2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100

Add a comment
Know the answer?
Add Answer to:
1. Describe an intrinsic function. Give an example. 2. Write the for loop with a print...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a MATLAB script, using either a single or nested for-loop, that will print the factorials...

    Write a MATLAB script, using either a single or nested for-loop, that will print the factorials for the numbers between 1 and 100 (inclusive). The factorial of n (n!) is the product of the positive integers less than or equal to n. For example: 3! = 3 * 2 * 1. For this question you cannot use the built-in MATLAB factorial function, but you can use other MATLAB functions if you wish. MATLAB code!MATLAB code!MATLAB code!MATLAB code!

  • Python programming: Write a while loop that prints a. All squares less than n. For example,...

    Python programming: Write a while loop that prints a. All squares less than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81. b. All positive numbers that are divisible by 10 and less than n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90 c. All powers of two less than n. For example, if n is 100, print 1 2 4 8 16...

  • Using Python Version 1. Write a program that uses a "while" loop to print the first...

    Using Python Version 1. Write a program that uses a "while" loop to print the first 10 positive integers and to compute their sum. Print the sum after it is computed. Do the same with a "for" loop. Version 2. Write a program to approximate the square root of a number. Recall that the square root of a number x is a number r such that r*r = x. Newton discovered that if one initial estimate of r is z...

  • In python using a def main() function, Write a function that will print a hello message,...

    In python using a def main() function, Write a function that will print a hello message, then ask a user to enter a number of inches (should be an integer), and then convert the value from inches to feet. This program should not accept a negative number of inches as an input. The result should be rounded to 2 decimal places(using the round function) and printed out on the screen in a format similar to the example run. Use a...

  • 1. Print out information of PHP use phpinfo() function. 2. Write a program that check and...

    1. Print out information of PHP use phpinfo() function. 2. Write a program that check and print odd / even numbers (from number 1 to 100 using for/while loop). Display the results within an HTML table with 2 columns as shown below: NUMBERS RESULTS 1 ODD 2 EVEN 3 ODD HINT: use <table> tags to create a table, <th> tags for ‘Numbers’ and ‘Results’. Wrap code PHP inside HTML code. For example: ​<html> ​​<title>CHECK ODD or EVEN</title> ​​<body> ​​​<table> ​​​​<?php...

  •     Write a for loop to print the odd numbers from 1 to 99 (inclusive)....

        Write a for loop to print the odd numbers from 1 to 99 (inclusive). Print one number per line. There is no input from the user on this problem.  

  • Problem 1 1 def modify(word.ch). word == word + ch return word print('new word is', word)...

    Problem 1 1 def modify(word.ch). word == word + ch return word print('new word is', word) To run the function modify() defined above, we make the following call: result = modify('course', 's') Find and fix the errors in the function definition, lines (1) to (4), such that after the call is executed: • Variable result has the value 'courses' • 'new word is courses' is printed out. For each error found and fixed, you must indicate the following: • line...

  • 1. Write an EBNF rule that defines a FORTH infinite loop. This is a loop with...

    1. Write an EBNF rule that defines a FORTH infinite loop. This is a loop with no while inside it. Look up the precise definition in the FORTH reference spreadsheet. 2. Look up the syntax for the FORTH counted loop and draw a syntax diagram for it. There are two forms, one where you add to the loop variable and the other where you subtract from it. Handle both. 3, Write the following FORTH function that uses an if statement...

  • C++ Assignment 4 - For example 2, write a non recursive version of this function... using...

    C++ Assignment 4 - For example 2, write a non recursive version of this function... using a regular loop. Let's consider writing a function to find the factorial of an integer, N!. For example 7! equals 7*6*5*4*3*2*1. int myFactorial( int integer) if( integer == 1) return 1; else return (integer * (myFactorial (integer-1))); // action performed on call - pass into function "integer - 1" // action performed on return *

  • Problem Summary This is a basic problem that uses a for-loop. Write a function called vector_multiply...

    Problem Summary This is a basic problem that uses a for-loop. Write a function called vector_multiply that takes two vectors of the same length as input arguments and returns one row vector as output Each component of the output vector is the product of the corresponding components in the two input vectors. However, this function must not use an array operation it must instead use a for-loop. For example, >>product - vector_multiply([1, 2, 3, 6], [9, 6, 4, 0]) product...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT