Skip to content

Commit cb7daa1

Browse files
authoredJul 6, 2021
Add files via upload
Happy learning
1 parent a3f2d2d commit cb7daa1

File tree

5 files changed

+92
-0
lines changed

5 files changed

+92
-0
lines changed
 

‎Simplecalculas.c

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
int a,b,add,sub,mul;
6+
float div;
7+
printf("Here You go for the calculation");
8+
printf("\nGive the two numbers to continue");
9+
scanf("%d %d",&a,&b);
10+
add = a+b;
11+
sub = a-b;
12+
mul = a*b;
13+
div=a/b;
14+
printf("And the result for two numbers \n-> addition is %d \n-> Subtraction is %d\n-> Multiplication is %d \n-> Division is %d",add,sub,mul,div);
15+
}

‎Typecheck.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <stdio.h>
2+
3+
void main()
4+
{
5+
printf("type size (bytes)");
6+
printf("\n character %d",sizeof(char));
7+
printf("\n Integer %d",sizeof(int));
8+
printf("\n long Int %d",sizeof(long int));
9+
printf("\n double %d",sizeof(double));
10+
}

‎checkarmstrong.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdio.h>
2+
int main() {
3+
int num, originalNum, remainder, result = 0;
4+
printf("Enter a three-digit integer: ");
5+
scanf("%d", &num);
6+
originalNum = num;
7+
8+
while (originalNum != 0) {
9+
remainder = originalNum % 10;
10+
11+
result += remainder * remainder * remainder;
12+
13+
originalNum /= 10;
14+
}
15+
16+
if (result == num)
17+
printf("%d is an Armstrong number.", num);
18+
else
19+
printf("%d is not an Armstrong number.", num);
20+
21+
return 0;
22+
}

‎leapyear.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdio.h>
2+
int main()
3+
{
4+
int year;
5+
printf("Enter ur birthday year to check its is leap year or not?");
6+
scanf("%d", &year);
7+
8+
if(year%4 == 0){
9+
if (year%100 ==0)
10+
{
11+
if(year%400 == 0)
12+
printf("%d is a leap year",year);
13+
else
14+
printf("%d is not a leap year",year);
15+
}
16+
else
17+
printf("%d is a leap year",year);
18+
}
19+
else
20+
printf("%d is not a leap year",year);
21+
return 0;
22+
}

‎quadequation.c

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <stdio.h>
2+
#include <math.h>
3+
4+
int main(){
5+
int a,b,c;
6+
int d,root1, root2;
7+
8+
printf("Enter the valid value of a,b,c");
9+
scanf("%d%d%d",&a,&b,&c);
10+
d = b*(b-4)*a*c;
11+
12+
if(d>0)
13+
{
14+
printf("roots are complex numbers\n");
15+
return 0;
16+
}
17+
18+
else{
19+
root1 = (-b+sqrt(d))/(2*a);
20+
root2 = (-b-sqrt(d))/(2*a);
21+
printf("roots fo quadratic equation are: %d %d",root1,root2);
22+
}
23+
}

0 commit comments

Comments
 (0)
Please sign in to comment.