- SUM OF TWO NUMBERS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int main() | |
{ | |
float a,b,sum; | |
printf("Enter the first number: "); | |
scanf("%f",&a); | |
printf("Enter the second number: "); | |
scanf("%f",&b); | |
sum = a + b; | |
printf("The Sum of the two numbers is %f",sum); | |
getch(); | |
return(0); | |
} |
- DISPLAYING NAME & AGE FROM USER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int main() | |
{ | |
char name[20]; | |
int age; | |
printf("Enter your name: "); | |
scanf("%s",&name); | |
printf("Enter your age: "); | |
scanf("%d",&age); | |
printf("Hello %s and you are %d years old.",name,age); | |
getch(); | |
return(0); | |
} |
- DECIMAL, FLOATING POINT & CHARACTER INPUT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
char a; | |
int b; | |
float c; | |
printf("Enter a Single Character: "); | |
scanf("%c",&a); | |
printf("Enter a Decimal Integer: "); | |
scanf("%d",&b); | |
printf("Enter a Floating point value: "); | |
scanf("%f",&c); | |
printf("The items you entered are %c , %d and %f",a,b,c); | |
getch(); | |
return(0); | |
} |
- ARITHMETIC OPERATIONS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int main() | |
{ | |
float a,b; | |
int c,d; | |
printf("Enter the first number: "); | |
scanf("%f",&a); | |
printf("Enter the second number: "); | |
scanf("%f",&b); | |
printf("\nThe sum of the two numbers is %f ",a+b); | |
printf("\nThe difference between the two numbers is %f ",a-b); | |
if(b==0) | |
{ | |
printf("\nDivision is not possible."); | |
} | |
else | |
{ | |
printf("\nThe quotient is %f",a/b); | |
c=(int)a; | |
d=(int)b; | |
printf("\nThe reminder of division is %d ",c%d); | |
} | |
getch(); | |
return(0); | |
} |
Comments
Post a Comment