Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Practical report.md #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Upneet90
Copy link

No description provided.

Copy link

@AVINASH379-beep AVINASH379-beep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include<stdio.h>
int main()
{
   puts("PPPPP    PPPPP      SSSS  ");
   puts("P    P   P    P    S      ");
   puts("P     P  P     P  S       ");
   puts("P    P   P    P    S      ");
   puts("PPPPP    PPPPP      SSS   ");
   puts("P        P             S  ");
   puts("P        P              S ");
   puts("P        P             S  ");
   puts("P        P         SSSS   ");
} 
Output:-
PPPPP    PPPPP     SSSS
P    P   P    P   S
P     p  P     P S
P    p   P    P   S
PPPPP    PPPPP     SSS
P        P            S
P        P             S
P        P            S
P        P        SSSS

6. Program to print a calcuator:-

 #include<stdio.h>
int main()
{
    puts("\n\
         _______________\n\
        | 1 | 2 | 3 |   |\n\
        |___|___|___|   |\n\
        | 4 | 5 | 6 | + |\n\
        |___|___|___|___|\n\
        | 7 | 8 | 9 | - |\n\
        |___|___|___|___|\n\
        |     0     | * |\n\
        |___________|___|\n");
}
Output:-
 _______________
| 1 | 2 | 3 |   |
|___|___|___|   |
| 4 | 5 | 6 | + |
|___|___|___|___|
| 7 | 8 | 9 | - |
|___|___|___|___|
|     0     | * |
|___________|___|

7. To print a face using puts:-
#include<stdio.h>
int main()
{
puts(" OOOOOOOO ");
puts(" O ^ ^ O ");
puts(" O - - O ");
puts(" O O ");
puts(" O ^ O ");
puts(" O O ");
puts(" O ----- O ");
puts(" O O ");
puts(" OOOOOOOO ");
}
Output:-
OOOOOOOO
O ^ ^ O
O - - O
O O
O ^ O
O O
O ----- O
O O
OOOOOOOO

8. To Identify prime numbers:-
#include<stdio.h>
int main()
{
int i, n, count=0;
printf("Enter the Number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
{
count ++;
}
}
if(count==2)
printf("Its a Prime Number");
else
printf("Its not a prime Number");
}
Output:-
Enter the number:23
Its a Prime Number
9. Program of Multiplication of 2x2 Matrix

#include<stdio.h>
int main()
{
   float a,b,c,d,e,f,g,h,i,j,k,l;
    printf("\nSample of Ist matrix: | a=1      b=2 |\n                      | c=3      d=4 |\n\n\
   Sample of 2nd matrix: | e=5      f=6 |\n                      | f=7      h=8 |\n\n");
    printf("Enter The Valve of a: ");
   scanf("%f",&a);
   printf("Enter The Valve of b: ");
   scanf("%f",&b);
   printf("Enter The Valve of c: ");
   scanf("%f",&c);
   printf("Enter The Valve of d: ");
   scanf("%f",&d);
   printf("Enter The Valve of e: ");
   scanf("%f",&e);
   printf("Enter The Valve of f: ");
   scanf("%f",&f);
   printf("Enter The Valve of g: ");
   scanf("%f",&g);
   printf("Enter The Valve of h: ");
   scanf("%f",&h); 
    i=(a*e)+(b*g);
   j=(a*f)+(b*h);
   k=(c*e)+(d*g);
   l=(c*f)+(d*h);
    printf("\nMultiplication of A,B is: | %.2f     %.2f |\n                          | %.2f     %.2f |",i,j,k,l);
    return 0;
}
 Output:-
Sample of Ist matrix: | a=1      b=2 |
                      | c=3      d=4 |
 Sample of 2nd matrix: | e=5      f=6 |
                      | f=7      h=8 |
 Enter The Valve of a: 5 
Enter The Valve of b: 6
Enter The Valve of c: 7
Enter The Valve of d: 3
Enter The Valve of e: 2
Enter The Valve of f: 3
Enter The Valve of g: 3
Enter The Valve of h: 5
 Multiplication of A,B is: | 28.00     45.00 |
                          | 23.00     36.00 |

10. Program to multily 2 numbers using Function:-
#include<stdio.h>
float guna(float a, float b);
int main()
{
float a, b, multi;
printf("Enter the 1st Value:");
scanf("%f",&a);
printf("Enter the 2nd Value:");
scanf("%f",&b);
multi=guna(a,b);
printf("Multiplication of a and b is%.3f", multi);
return 0;
}
float guna(float a, float b)
{
return a*b;
}
Output:-
Enter the 1st Value:5
Enter the 2nd Value:4
Multiplication of a and b is 20.000
11. Program to find Area of the Circle:-

#include<stdio.h>
int main()
{
    float r, A;
    float pi = 22/7;
    printf("Enter the Radius of Circle:");
    scanf("%f",&r);
    A = pi*r*r;
    printf("Area of Circle is %.3f",A);
    return 0;
}
Output:-
Enter the Radius of Circle:4
Area of Circle is 48.000

12. Program to Find Average of Three numbers:-
#include<stdio.h>
int main()
{
float a, b, c, d;
printf("Enter the value of a:");
scanf("%f",&a);
printf("Enter the value of b:");
scanf("%f",&b);
printf("Enter the value of c:");
scanf("%f",&c);
printf("The average of a, b and c is %.2f",d=(a+b+c)/3);
return 0;
}
Output:-
Enter the value of a:6
Enter the value of b:9
Enter the value of c:19
The average of a, b and c is 11.33
13. Program which can find the maximum among 2 numbers:-
#include<stdio.h>
int main()
{
float a, b;
printf("Enter the 1st number:",a);
scanf("%f",&a);
printf("Enter the 2nd number:",b);
scanf("%f",&b);
if(a>b)
{
printf("%.2f is greater than %.2f",a, b);
}
else
{
printf("%.2f is greater than %.2f",b, a);
}
return 0;
}
Output:-
Enter the 1st number:45.32
Enter the 2nd number:45.48
45.48 is greater than 45.32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants