حل شيت البرمجه بلغه c
البرنامج الاول
#include<stdio.h>
#include<conio.h>
void main(void)
{
float x,y,out;
char z;
printf("\t\t\twelcome to the calculator\n\n");
printf("* enter the first number:");
scanf("%f",&x);
printf("\n");
printf("* enter the second number:");
scanf("%f",&y);
printf("\n");
printf("* click \n");
printf("\t <a> for ADD \n");
printf("\t <s> for SUBSTRACTE \n");
printf("\t <d> for DIVIDE \n");
printf("\t <m> for MULTIPLY \n");
printf("\t enter your choice here: ");
z=getche();
if(z=='a')
{
out=x+y;
printf("\n\n\t\t\t\t the result is : %5.6f\n\n",out);
}
else if(z=='s')
{
out=x-y;
printf("\n\n\t\t\t\t the result is : %f\n\n",out);
}
else if(z=='d')
{
out=x*y;
printf("\n\n\t\t\t\t the result is : %f\n\n",out);
}
else if(z=='m')
{
out=x/y;
printf("\n\n\t\t\t\t the result is : %f\n\n",out);
}
printf("\t\t\t thanks for using the program\n\n");
}
----------------------------------------------------------------------------------------
البرنامج الثانى
#include<stdio.h>
void main(void)
{
char name[30];
printf("\n");
printf("enter your name:");
scanf("%s",&name);
printf(" welcome mr. %s",name);
printf("\n");
}
---------------------------------------------------------------------
البرنامج الثالث
#include<stdio.h>
void main (void)
{
int i;
for(i=1;i<=3;i++)
printf("hello\n",i);
}
------------------------------------------------------------------------
البرنامج الرابع والاخير
#include<stdio.h>
#include<conio.h>
void main (void)
{
int i;
char name[30];
do{
printf("enter your name:");
gets(name);
printf("\n");
printf("welcome mr. %s",name);
printf("\n\n");
printf("do you want to begin <y/n> :");
}while(getche()!='y');
printf("\n\n");
printf("please enter your password :");
scanf("%d",&i);
printf("\n");
if (i==123)
printf("\t invalid password \n\n");
}