ACP2_9

#include<stdio.h> void main() { struct{ char name[30]; float basic,da,hr,netsal; }emp[5],temp; int a,b; clrscr(); printf("\nEmployee Details -\n"); for(a=0;a<5;a++) { printf("\nEmployee %d -",a+1); printf("\nName : "); flushall(); gets(emp[a].name); printf("Basic : Rs."); flushall(); scanf("%f",&emp[a].basic); printf("DA : Rs."); flushall(); scanf("%f",&emp[a].da); printf("HR : Rs."); flushall(); scanf("%f",&emp[a].hr); emp[a].netsal=emp[a].basic+emp[a].da+emp[a].hr; } for(a=0;a<5;a++) for(b=a+1;b<5;b++) if(emp[a].netsal<emp[b].netsal) { temp=emp[a]; emp[a]=emp[b]; emp[b]=temp; } clrscr(); printf("\nEmployee Details -\n"); for(a=0;a<5;a++) { printf("\nEmployee %d -",a+1); printf("\nName : %s",emp[a].name); printf("\nBasic : Rs.%6.2f" " - DA : Rs.%6.2f - HR : Rs.%6.2f",emp[a].basic,emp[a].da,emp[a].hr); printf("\nNet Salary : Rs.%6.2f\n",emp[a].netsal); } getch(); } void force() { float x,*y; y=&x; x=*y; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.