Viva Question: All Questions Are Compulsory (10 X 3)
Viva Question: All Questions Are Compulsory (10 X 3)
Viva Question: All Questions Are Compulsory (10 X 3)
maximum/minimum array
1. #include <stdio.h>
2. int find_maximum(int[], int);
3. int main() {
4. int c , array[100], size, location, maximum;
5. printf("Input number of elements in array\n");
6. scanf("%d,&size);
7. printf("Enter %d integers\n", size);
8. for (c=0;c< size;c++)
9. scanf("%d",&array[c]);
10. location= find_maximum(array, size);
11. maximum =array[location];
12. printf("Maximum element location = %d and value = %d.\n", location +1, maximum);
13. return 0;
14. }
15. int find_maximum(int a[], int n {
16. int c, max, index;
17. max = a[0];
18. index =0;
19. for (c=1; c< n; c++){
20. if (a[c]> max {
21. index = c;
22. max =a[c];
23. }
24. }
25. return index;
26. }
1. #include <stdio.h>
2. int main()
3. {
4. int n, t, sum=0,remainder;
5. printf("Enter an integer\n");
6. scanf("%d",&n);
7. t = n;
8. while (t!= 0)
9. { remainder=t%10;
10. sum=sum+remainder;
11. t = t /10; }
12. printf("Sum of digits of %d =%d\n",n,sum);
13. return0;
14. }
• What are the key features in C programming language?
To solve the computing problem, its solution must be specified in terms of sequence of
computational steps such that they are effectively solved by a human agent or by a digital
computer.
C's ability to communicate directly with hardware makes it a powerful choice for system
programmers. In fact, popular operating systems such as Unix and Linux are written entirely in
C. Additionally, even compilers and interpreters for other languages such Fortran, Pascal, and
Basic are written in C. However C's scope is not just limited to developing system programs. It is
also used to develop any kind of application, including complex business ones.Some areas where
C language is used:
• Embedded Systems
• Systems programming
• Artificial Intelligence
• Industrial Automation
• Computer Graphics
• Space Research
Keyfetures of C language
• C is simple
• There are only 32 keywords so C is very easy to master. Keywords are words that have
special meaning in C language.
• C programs run faster than programs written in most other languages.
• C enables easy communication with computer hardware making it easy to write system
programs such as compilers and interpreters.
Primary data type are integer, character (used to store character), float,double etc, these are
fundamental datatypes of C language.
Derived data typpes- these are nothing but primary data types, these are some different and
grouped together for example array, structure and union.
user defined data type- as the name implies these are defined by user itself.
Header files are special files which stores library functions that are predefined.
We are using printf() & scanf() functions in our program then we have to include
#include<stdio.h> header file. It is for standard i/o. If we don't include the the header files we
can't run your program. Therefore we have to include the header files.
Another header file is #include<conio.h> which is for console i/o. This header file stores clrscr()
& getch() functions. clrscr() is for clearing the screen & getch() is holding the screen until we
press any single character from keyboard.
Also we have lots of different header files which stores different functions
for example
#include<math.h> (for mathematic functions)
header file are compulsary part of a program . we can create our own header file also.
etc.