1 / 7

C LANGUAGE : SEM VI

C LANGUAGE : SEM VI. Dr . Faiyaz Gadiwalla Hinduja College. C LANGUAGE : SEM VI Typical Questions. Q 2 A) a) Wages calc. b) Sort c) Output Q3 A) a) Series b) Display result c) Output. C LANGUAGE : SEM VI Typical Questions. Q 2 A) a) Sales Tax b) DA, HRA c) Output

tan
Télécharger la présentation

C LANGUAGE : SEM VI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. C LANGUAGE : SEM VI Dr. FaiyazGadiwallaHinduja College

  2. C LANGUAGE : SEM VITypical Questions Q 2 A) a) Wages calc. b) Sort c) Output Q3 A) a) Series b) Display result c) Output

  3. C LANGUAGE : SEM VITypical Questions • Q 2 A) • a) Sales Tax • b) DA, HRA • c) Output • Q3 A) • a) Series • b) Depreciation • c) Theory

  4. C LANGUAGE : SEM VI • What is the output of the following C program? • #include <stdio.h> • void main() • { int x=1,y=10,z=5; • float s=0; • x++; • y+=x++*z; • z--; • s+=x/y; • printf("\n%d %d %d\n",x,y,z); • printf("%f\n",s); • }

  5. C LANGUAGE : SEM VI • Write a program to input the marks of a student in three subjects and calculate the total and average marks. Display the result of the student along with the total and average marks where the result is ‘Pass” if the student gets 35 or more marks in each subject, otherwise result is “Fails” • #include <stdio.h> • void main() • { float m1,m2,m3,tm,avg; • printf(“Enter the marks in 3 subjects\n”); • scanf(“%f %f %f”,&m1,&m2,&m3); • tm=m1+m2+m3; • avg=tm/3; • printf(“Total marks = %.2f and Average marks = %.2f\n”,tm,avg); • if(m1>=35 && m2>=35 && m3>=35) • printf(“Passes\n”); • else • printf(“Fails\n”); • }

  6. C LANGUAGE : SEM VI • Write a program in C to accept sales from the keyboard and calculate and display sales tax as per the following: SALES SALES TAX • uptoRs 5,000 5% of sales • between Rs 5000 and uptoRs 9000 10% of sales • Over Rs 9000 12% of sales • Note: Here the sales tax is to be calculated as a flat rate of the Sales. • #include <stdio.h> • void main() • { float s,st; • printf(“Enter the sales “); • scanf(“%f”,&s); • if(s<=5000) • st=s*.05; • else if(s>5000 && s<=9000) /*we can also just write else if(s<=9000) */ • st = s*.10; • else • st = s*.12; • pritnf(“Sales Tax = %.2f\n”,st); • }

  7. C LANGUAGE : SEM VI • Write a Program in C to input the Name, grade and basic salary of an employee of a factory and calculate the Bonus using the switch statement. Display the Name and bonus where • Grade Bonus • A 50% of Basic • B 60% of Basic • C 70% of Basic • Rest 80% of Basic • #include <stdio.h> • void main() • { char n[20]; • char gr; • float bs, b; • printf(“Enter name, grade and basic pay “); • scanf(“%s %c %f”, n, &gr, &bs); • switch(gr) • { case ‘A’: • b = bs*.50; • break; • case ‘B’: • b= bs*.60; • break; • case ‘C’: • b= bs*.70; • break; • default: • b= bs*.80; • break; • } • printf(“Name = %s\n”, n); • printf(“Bonus = %.2f\n”, b); • }

More Related