0% found this document useful (0 votes)
10 views2 pages

Nmltlab 1

Uploaded by

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

Nmltlab 1

Uploaded by

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

B1:

#include <stdio.h>
#include <stdlib.h>

int main() {
int s;
int m = 0;
int i = 1;
printf("%s","");
scanf("%d",&s);

while(m<=s-1) {
i += 1;
m += i;
}
if (i-1==0 || s == 0)
printf("Not found!");
else
printf("%d",i-1);

return 0;
}

B2:
#include <stdio.h>
#include <stdlib.h>

int main() {
int h;
printf("%s","");
scanf("%d",&h);

for (int i = 1; i<=h; i++) {


for (int j=1; j<=h-i;j++)
printf(" ");
for (int n=1;n<=2*i-1;n++) {
printf("*");
}
printf("\n");

return 0;
}

B3:
#include <stdio.h>
#include <stdlib.h>

int main() {
int n; int u;
printf("%s","");
scanf("%d",&n);

if (n>1) {
for (int i = 1; i<=n; i++) {
if (n % i == 0) {
if (i==1 || i == n)
u = 1;
else {
u = 0;
break;
}
}
}
}
else
u = 0;

if (u==0)
printf("%d khong phai la so nguyen to!",n);
else
printf("%d la so nguyen to!",n);

return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy