Professional Documents
Culture Documents
CODOO|QQS C
Start here X Lguestion5.b.c X
2
#1ncAUsers\ HP\Documentsquestion 5 b.C
nt naiH7 1
3 int n, 1,
varE
printf ("Enter a positive integer: ") ;
scanf ("ad", &n)
for (i =
2: i <=n/ 2: ++i)
if (n * i =
0) (
0 var 1;
11 break;
12
L3
14
i f (n == 1)
printf("1 is neither prime nor composite. ") ;
18 eLse
19 if (var = 0)
20 is prime number. ", n);
else
printf(" *d a
27
Logs&others
Code:BlocksX Search results X Cccc x Rild lon X Rild meccanec x conChecAlors,.Y cCe
nChoclc0
T
int a, D, X, Y. n:
printt("Enter the value of a: ");
scanf(*d",sa);
printt ("Enter the value or bi )
scant(d", b):
printE("Enter the value Or **
scant("*
printr(nter the value or n: )
12 scant(d,an)
13 svitch (n)
14 1
case *
*\D
7
8 break
9 cAse
Ya (x**})+ (b°b)
rntE(ine value or y d\n, Y
break;
case
printr(Ine value or y din, Y
break;
Case
return
Lnclude
main (
| int a=0,b=l,i, C, n;
printf ("enter the value of n : \n");
Scanf("%d", &n) ;
printf ("sd, ""sd, ", a,b));
10 for (i=1#ic=n-2;i++)
11
12 C atb;
13 printf("$d,", c)
14 a-b
15 b-c
16
17
18
19
D0O|aals C
tart here X question 5 b.c X *question 4a.c X question 5a.c X question 5f.c X
#1nclude <stdio.h>
int main ()
int i, j, n=3;
return 0;
17
Logs& others
Code:Blocks X Search results X Cccc x Ruild loa x Ruild mecca ConChark0lorn nnf
stion S D.C question 4a.c question 5a.c question S1.C question Da.c
#include <stdio.h>
void main ()
while (originalNum != 0)
// remainder contains the last digit
remainder = originalNum * 10;
if (result == num)
return 0:
quesuo9 ec
estion 5 D.C*
question 4a.C2 question a . c question Sf.c AquestiIon 5a.c Aqueston 5 C.C
#include <stdio.h>
int main ()
int num, 1, count = 0;
lnt prime = 1;
i f (num.i == 0)
Prime O;
break;
i f (prime)