C program
- lcm of two numbers in c LCM of two numbers = (product of the numbers) ÷ HCF, where the HCF is found with Euclid's algorithm. #include <stdio.h> int gcd(int a, int b... 1
- When is a switch statement can be better than an if statement? If you have more than one condition to check on single variable or a single expression, then switch is better than if. In switch statement,... 1
- In the case of character array what is the difference b/w strlen() and sizeof() ? In character array strlen() returns the number of characters, while sizeof() returns the number of occupied bytes by character array. Exampl... 1
- What is the difference between printf() and puts() ? The function printf() writes the data on standard output device with the ability of formatted string using %c, %d, %s, %20s .. etc and print... 1
- What is a main() and difference b/w void main() and int main()? main() is an entry point ( main function) which is in most programming languages, When compiler begins compile the program, It looks for an... 1
- What is the return type of scanf() function, and what it returns ? scanf() is a library function, the prototype of scanf() is availabe in <stdio.h>, It returns a integer value, that describe successful input... 1
- What is the return type of printf() function, and what it returns ? printf() is a library function, the prototype of printf() is available in <stdio.h>, It returns a interger value, that describe how many cha... 1
- How many keywords & operators are used in c Language? There are 32 keywords & 45 operators that are used in c programming language. 1
- What is modular programming? Modular programming is a program design technique in which a large program is divided into sub programs/ functions that are called modules,... 1
- Difference b/w Entry controlled and Exit controlled loop? In Entry Controlled Loop, loop body is checked after checking the test condition i.e. condition is checked first after that loop body will e... 1
- What is fall down property? In C Programming Language, switch case statement follows the fall down property. It means when case block is executed and break statement is... 1
- Which loop statement is executed at least once even loop test condition if false? do while loop executes once even loop test condition if false. Since do while is an exit controlled loop and in this type of loop, loop body... 1
- Can we use single statement in loop body without using curly braces "{...}"? Yes, when loop body has single statement, than we can escape curly braces "...". Consider the example: Yes, when loop body has single statem... 1
- What are the jumping statements in C Language and how these work? In C Programming, some special statements are used to transfer program control to one location to other location. There are following jumpin... 1
- What is infinite loop? A loop which is never finished is known as infinite loop, it means the looping condition is always true, so that loop never terminate. Infin... 1
- Which loop is good for programming? It depends on the programming need, we can not say which is best to use. Where condition checking is required before body execution, just us... 1
- Can we use continue statement without using loop? No, continue statement can only be used within the loops only, it can be any loop while, do while or for. If we use continue statement witho... 1
- Can goto statement transfer program control from one function to another function ? No, As we know that goto statement can transfer the program's control to specified label, But it has a limitation, as it can transfer progra... 1
- Whether the program in c can be executed by computer directly? Answer: No. The computer cannot execute a C program (source code) directly; it must first be translated into machine code by a compiler. The... 1
- In the below pattern columns are started from 1 to N, and the number of columns is equal to the number of rows. #include<stdio.h> int main() int n,i,j; printf("Enter the number of rows: "); scanf("%d",&n); for(i=1; i<=n; i++) for(j=1; j<=n; j++) printf... 1
- In the below pattern each column contains N number of stars where N is the number of rows. Code : #include<stdio.h> int main() int n,i,j; printf("Enter the number of rows: "); scanf("%d",&n); for(i=1; i<=n; i++) for(j=1; j<=n; j++)... 1
- How is a Function declared in C Language? A function in C language is declared as follows, return_type function_name(formal parameter list) { Function_Body; } 2
- Can I use int datatype to store 32768 value? Answer: It depends on the size of int. With a 16-bit int (e.g. Turbo C), no: its range is −32768 to 32767. With a 32-bit int (GCC, Visual C+... 1
- What is the main difference between the Compiler and the Interpreter? Compiler is used in C Language and it translates the complete code into the Machine Code in one shot. On the other hand, Interpreter is used... 2