Skip to main content

Featured

C Program to display spellings of number 1-10 on entry

C Program to display spellings of number 1-10 on entry.   #include<stdio.h>   void main() { int num; printf("Enter a number between 1-10:"); scanf("%d",&num); printf("\n"); switch (num) { case 1: printf("ONE"); break; case 2: printf("TWO"); break; case 3: printf("THREE"); break; case 4: printf("FOUR"); break; case 5: printf("FIVE"); break; case 6: printf("SIX"); break; case 7: printf("SEVEN"); break; case 8: printf("EIGHT"); break; case 9: printf("NINE"); break; case 10: printf("TEN"); break; default:         printf("THE ENTERED NUMBER IS NOT BETWEEN 1-10"); } } OUTPUTS

C Program to display the menu to execute ADD, SUBTRACT, MULTIPLICATION, DIVISION


C Program to display the menu to execute  ADD, SUBTRACT,
MULTIPLICATION, DIVISION using switch case.


#include<stdio.h>
void main()
{
float a,b,c;
int x;

printf("-------------------MENU--------------------");
printf("\nTYPE 1 for ADDITION");
printf("\nTYPE 2 for SUBSTRACTION");
printf("\nTYPE 3 for MULTIPLICATION");
printf("\nTYPE 4 for DIVISION\n");
printf("============================\n");
scanf("\n%d",&x);
printf("\nEnter the first number:");
scanf("%f",&a);
printf("\nEnter the second number:");
scanf("%f",&b);
switch(x)
{
case 1:
c=a+b;
printf("\nResult: %.2f+%.2f=%.2f",a,b,c);
break;
case 2:
c=a-b;
printf("\nResult: %.2f-%.2f=%.2f",a,b,c);
break;
case 3:
c=a*b;
printf("\nResult: %.2f*%.2f=%.2f",a,b,c);
break;
case 4:
c=a/b;
printf("\nResult: %.2f/%.2f=%.2f",a,b,c);
break;
default:
printf("\nIncorrect Choice");
break;
}
}

click the link for video: https://www.youtube.com/watch?v=BhNmDf6btxc&t=249s
OUTPUTS





Comments