[go: up one dir, main page]

0% found this document useful (0 votes)
48 views9 pages

PPS Codes

The document contains multiple C programming code snippets demonstrating various functions such as calculating factorial, handling arrays, matrix operations, and swapping values. Each code segment includes user input prompts and output statements, showcasing basic programming concepts and structures. Additionally, it includes compilation logs and warnings for each code segment.

Uploaded by

rp7218090993
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views9 pages

PPS Codes

The document contains multiple C programming code snippets demonstrating various functions such as calculating factorial, handling arrays, matrix operations, and swapping values. Each code segment includes user input prompts and output statements, showcasing basic programming concepts and structures. Additionally, it includes compilation logs and warnings for each code segment.

Uploaded by

rp7218090993
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

LUesatudert Desktcp'Ch*gres'Factenalngtuncticnc- ticul mg.

- Des-C--
<br>

S11
Eile
Jt Search Eujeut taeute euls tyle indew Help

[raLabals!
Project Casses Debug Aea (OF Circle,c Fectarial,using funcban.t

1 #include<stdio.h>
2 int factorial(int a);
3 void main()
44{ EAUserststudentDe:ktrp\ChikordesFactoial, using function.ese

5 int num, f; Enter numoer:5


tactorial is
6 printf("Enter number:"); Process exited after 2.534 seconds with return value 18

scanf("%d", &num) ;
.
Press any key to continue.
7
3 f =factorial(num) ;
=
printf("Factorial is %d", f);
10}
114 int factorial(int num) {
12 int i, fact=1;
13 for(i=1;i<=num; i+)
144
= *
15 fact fact i;
16 }
17 return fact;
18}
10
Resourres Find Reauts
E
Compåer tk Comple Log Debhug
d Close

ActConttiliri Canp11azion reaulta.,

Frtors: 0
Warninga:
sisershatuden:\Deakcp\chES*
-Qutcut Size: 123,6552734375 BAB
Canpi1acien T1me: .25n

line Lines 19 Lengthu 291 Inset Dene parsing in 0 secands


<br>

CAUserslaludentDesktop\Chikordealartey- Dert+ 5.11

File Edit Search Vae Project Eetute Toola AStyle Wmdow Help

|l gLabas!
Project Classes Debug arrc
.
1 #include<stdio h>
2 int main()

4 int i,arr[3];
printf("Enter Element") ;
3
6 for(i=0; i<3; i++)

scanf("%d", &arr [i]);

10 printf("Array elements are: ");


11 for(i=0; i<3; i++)
124
13 printf("%d", arr[i]) ;
14
15 return 0;
16
BR Compier Resources Compile Log Resuts
k Debug Find Cicse

Aser otailati Couplat13n results..

-
Warnings:
C

IShoten cemple peths C:\Useralstudent\Deskscp\Chikorde.ahazray.exe


-

Campilatcn Ine .279

LirE 1%
Cot 2
16 Lengtu 237 Irsert Done parsing in O setonds
CAUers\atudent Desktop\Chiturdeal2dimensianel - Dey-Ce- S.11
<br>

D
Ele Edt Search Yew roject EaeLte Jools style Wmdow Help

Project Classes Debug aray Zdimensionalc

1 #include<stdio. h>
2 void main()
3

int i,j;
5 int arr[3][3]:
6 printf("Enter 3 elements: ");
7 for (i=0; i<3; i+)
8

9 for (j=0; j<3; j++)


10+
11 scanf("%d", &arr[iJLIl);
12
13
14 printf("Elements of array are: ");
15 for (i=0; i<3; i+)
16+
17 printf("%d", arr[i][j]);
18 printf("\n");
19 }
20
21
BR Compiler Resources Compile Log Renuts
fk Debug Find Ciose
,

SAset Conailate Couplataon results.


-
Warninqs:
OShoten cemple paths
amH: C:\Useraatudens\Deakscp\Chikrde. itnal.exe
-OutuE S1zP: I28.7734373 KIE
-
Canpilatcn Tine: 0.279

LirE 20 Cot Set 0 Lies 21 Lengltu 306 Irsert Done parsing in U secornds
<br>

Project Classes Debug array.c Zdimensional.c mat ardd.c transpose_ mat.c

1 #include<stdio.h>
2 void main()
3{
int i,j, arr1[2][2],arr2[2] [2], arr3[2][2]3
5
printf("Enter first matrix:");
7 for(i=0; i<2; i++)
{
for(j=0;j<2;j++)
10
1 scanf ("%d", &arr1[iJ[il);
12
13
14 printf("Enter second matrix:");
15 for (i=0; i<2; i++)
16 {
17 for(j=0;j<2; j+)
18
scanf ("%d", &arr2[iJ[il);
20
21
22 for (i=0;ic2;i+)
23
24 for (j=0;j<2;j++)
25 {
= +
26 arr3[i] [] arr1[i] [j] arr2[i][Sl;
27
28
printf("Addition of matrices:\n");
30 for(i=0;i<2;i++)
31
32 for(j=0;j<2; j++*)
33J
34 printf("%d\t", arr3[i][i]);
36 printf("\n")5
37
38 L}

Compiler Resources dlh Compile Log DebugFind Results

Line 10 Col: 10 Sel: 0 Lines: 38 Lenqth: 566 Insert |Done parsing in 0 seconds
<br>

Project Classes Debug array.c 2dimensional.c mat ardd.c transpose_mat.c

1 #include<stdio.h>
2 void main()
3{
4 int i,j, arr1[2][2],transpose[2] [2] ;
5
printf("Enter first matrix:");
for(i=0; i<2; i++)
{
for(j=0;j<2;j++)
10
scanf("%d", &arr1[ij[i]);
12
13
14 printf("Original matrix is:\n");
15 for (i=0; i<2; i++)
16 {
17 for (j=0;j<2;j++)
18 |
19 printf("%d\t", arr1[iJLI);
20
21 printf("\n")
22
23 for(i=0; i«2; i++)
24J
25 for (j=0;j<2;j++)
26
transpose[i][i] =
27 arr1[3][i];
28

printf(""Transpose of matrix:\n");
31 for(i=0; i<2; i++)
32 {
33 for (j=0;j<2; j++)
34H {

printf("%d\t", transpose[i][j]);
B6
37 printf("\n");
38
39 L}
8 Compiler Resources dh Compile Log DebugFind Results

Line 28 Col: 10 Sel: C


Lines: 39 Length: 576 Insert |Done parsing in 0 seconds
<br>

Uiglsbe)
Project Clases Ilswsupirge

1 #include<stdio. h>
2 void main()

4 int a,b;
5 printf("Enter a and b: ");
6 scanf("%d%d" „&a, &b);
7 swapping(a, b) ;
8
9}
10 Swapping(int a, int b)
119{
12 int temp;
13 printf("number before swapping-%d and %d", a, b);
14 temp aj
15 a = b;
16 b= temp;
17 printf("The number after swapping= %d and %d" sa,b);
18
19 }
Compler Rescurces Compile Log Resuts
l Debugind Clcce

Complaci Da
results...

Warning3:
.
OShorten compiler palhs Ousput Eiletame: C:\Uaera\student\Deaktcp\Chikrde.a\awapg ing exe

Line 10 Cot 14 Dene pasing in seconds


Lines 19 Length: 30s Inuer
<br>

Project Classes s«spping.c sWeusingpoirter.t Urtitledi


1 #include<stdio.h>
2 void main()
39{
4 int a,b;
5 printf("Enter a and b: ");
6 scanf("%d%4" ,&a, &b);
7 Swapping(&a, &b) ;
8
9}
10 swapping (int *p, int *q)
11{
12 int temp;
13 printf("number before swapping=%d and %d", *p, *q) ;
temp =
14 *p;
15 *p = *qs
16 *q = temp;
17 printf("The number after swapping= %d and %d" *p,*q);
18
19}
HH Compler Resources ak Campile Log Debug Find Results Close

Comp1lasion zesulte.

-Ezrczs: 0
-Wrnings
Shaten compier paths aze1 C:\Uszs\atudenr\Des kzcp\Charorde.s\awapasingp
-
Output Size: l29.119149625 KiA
-Congi1acicn T1ine: 9.279

inar Lenath: 320 Inser Drne pasing in 0.016 seconds


<br>

Project Classes|struct.c

2
#include<stdio.h>
void main()
4 struct student
5E
int rollno;
char name[5];
int marks;

11 struct student name


s1;
printf("Enter of student 1");
13 scanf("%s" „&s1. name);
14
printf("enterroll no of student 1");
scanf("%d" „&s1.rollno) ;
printf("Enter marks of student 1");
19 scanf("%d" „&s1.marks);
2
21 printf("\n details is :\n");
;
printf("\n%s" ,s1.name)
23 printf("\%d" ,s1. rollno);
24 printf("\n%d" s1.marks);

Compiler Resources dh Compile Log Debug Find Results Close

Conpilation results...
Abort Compilation

EILOIS: 0
Warnings: 0
Output Filenane: C:\Users\student\Desktop\Chikorde Sohamn (A2) \struct. exe
Output Size: 128.7705079125 KiB
Compilation Tine: 0.25s

Line 24 Co: 34 Sel: 0 Lines: 27 Length: 535 Insert |Done parsing in 0 seconds
<br>

Project Classesstruct.c Mmuti_stud.c


1
#include<stdio.h>
void main()
3
struct student

int rollno;
7 char name[5]:
int marks;

int ij
struct student s[3];
for(i=0;i<=2; i++)

|5 printf("Enter name of student %d: ",i+1);


16 Scanf("%s" „&s[i].name) ;
17

printf("enter roll no of student %d: ", i+1);


scanf("%d" „8s[i].rollno);
20
21 printf("Enter marks of student %d: ", i+1);
22 scanf("%d" „&s[i] .marks);
23
24 printf("\ndetails is :\n");
25 for (i=0;i=2;i++)
26
7
printf("details of student %d is :\n",i+1);
28 printf("\n%s",s[i] .name);
.
printf("\n%d", s[i] rollno);
36 printf("\n%d", s[i] .marks);
21
32
33
L
34
35

Compiler T Resources dh Compile Log Debug Find Results Close

Conpilation results...
Abart Gompilation

EIroIS: 0
Warnings: 0

Shorten compiler paths Output. Filename: C:\Users\student\ Desktop\Chikorde Soham (A2) \multi stud.exe
Output Size: 128.7705078125 KiB
Conpilation Time: 0.27s

Line: 34 Col: 1
Selt 0 Lines: 35 Length: 697 Insert Done parsing in 0.016 seconds

You might also like