Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Faiyaz Gadiwalla Hinduja College. Q 2 A) a) Wages calc. b) Sort c) Output Q3 A) a) Series b) Display result c) Output.

Similar presentations


Presentation on theme: "Dr. Faiyaz Gadiwalla Hinduja College. Q 2 A) a) Wages calc. b) Sort c) Output Q3 A) a) Series b) Display result c) Output."— Presentation transcript:

1 Dr. Faiyaz Gadiwalla Hinduja College

2 Q 2 A) a) Wages calc. b) Sort c) Output Q3 A) a) Series b) Display result c) Output

3 C LANGUAGE : SEM VI Typical 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 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 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:SALESSALES TAX upto Rs 5,0005% of sales between Rs 5000 and upto Rs 900010% 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 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 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); }


Download ppt "Dr. Faiyaz Gadiwalla Hinduja College. Q 2 A) a) Wages calc. b) Sort c) Output Q3 A) a) Series b) Display result c) Output."

Similar presentations


Ads by Google