June 13, 2021 in C and CPP
What is printed after execution of each of the following C-programs? void main(){float reals[5];*(reals+1) = 245.8;*reals = *(reals + 1);printf(“ %f”, reals[0] );} void main( ){ int nums[3];int ptr = nums; nums[0] = 100; nums[1] = 1000; nums[2] = 10000; printf( “%d\n”, ++ptr );printf( “%d”, *ptr );} void main(){ int digit =0;while (digit <= 9)printf( […]
June 13, 2021 in C and CPP
Write a ‘C’ program to calculate and display the monthly income of a salespersoncorresponding to the value of monthly sales input in the scanf() function, let us considerthe following commission schedule: (Note: use if-else statement)Monthly Sales IncomeGreater than or equal to Rs.50,000 375 plus 16% of salesLess than Rs. 50,000 butGreater than or equal to […]
June 13, 2021 in C and CPP
Write a C program that reads integers from the file scores.dat. After all the integers havebeen read, the program writes the sum of all the nonnegative integers to the videodisplay. Assume that the file scores.dat contains at least one integer.