June 22 S
June 22 S
printf("Maximum element is present at location %d and its value is %d.\n", location+1, array[location]);
return 0;
}
13 a) Any 4 data types with explanation - 4 marks. Memory requirements- 3 marks. (7)
int or signed int-2bytes
Integers are whole numbers that can have both zero, positive and negative values but no decimal values.
Float -4 bytes
Float and double are used to hold real numbers. The floating-point data type allows the user to type decimal
values. For example, average marks can be 97.665. if we use int data type, it will strip off the decimal part
and print only 97. To print the exact value, we need ‘float’ data type.
Char-1 byte
char stores a single character. Char consists of a single byte.
Double-8 bytes
Double is 8 bytes, which means you can have more precision than float. This is useful in scientific programs
that require precision. Float is just a single-precision data type; double is the double-precision data type.
Size given is compiler /os specific.....Eg: int is 4 bytes in gcc linux and mark must be given
b) Correct Program- 7 marks (7)
OR
14 a) formatted I/O functions with example-3.5 marks (7)
Unformatted I/O functions with example-3.5 marks
int main()
{
int m, n, c, d, matrix[10][10], transpose[10][10];
printf("Enter the number of rows and columns of a matrix\n");
scanf("%d%d", &m, &n);
printf("Enter elements of the matrix\n");
OR
16 a) Correct program-7 Marks (7)
#include <stdio.h>
#include <string.h>
int main()
{
char Str[100], RevStr[100];
int i, j, len;
j = 0;
len = strlen(Str);
return 0;
}
pt = &arr1[n - 1];