Loopall 28 Ap

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 9

1. #include <stdio.

h>
int main(){
for(int i=1;i<=5;i++){
printf("%d",i);
}
return 0;
}

2. #include <stdio.h>
int main(){
for(int i=1;i<=10;i++){
printf("%d",i);
}
return 0;
}
3. #include <stdio.h>
int main(){
for(int i=1;i<=50;i++){
printf("%d",i);
}
return 0;
}

4. #include <stdio.h>
int main(){
for(int i=50;i<=100;i++){
printf("%d ",i);
}
return 0;
}

5. #include <stdio.h>
int main(){
for(int i=34;i<=89;i++){
printf("%d ",i);
}
return 0;
}

6. #include <stdio.h>
int main(){
for(int i=5;i>=1;i--){
printf("%d ",i);
}
return 0;
}

7.#include <stdio.h>
int main(){
for(int i=10;i>=1;i--){
printf("%d ",i);
}
return 0;
}

8. #include <stdio.h>
int main(){
for(int i=100;i>=1;i--){
printf("%d ",i);
}
return 0;
}

9.#include <stdio.h>
int main(){
for(int i=500;i>=50;i--){
printf("%d ",i);
}
return 0;
}

10.#include <stdio.h>
int main(){
for(int i=56;i>=23;i--){
printf("%d ",i);
}
return 0;
}

11. #include <stdio.h>


int main(){
for(int i=1;i<=5;i++){
if(i%2==0)
printf("%d ",i);
}
return 0;
}

12.#include <stdio.h>
int main(){
for(int i=1;i<=10;i++){
if(i%2==0)
printf("%d ",i);
}
return 0;
}

13. #include <stdio.h>


int main(){
for(int i=1;i<=100;i++){
if(i%2==0)
printf("%d ",i);
}
return 0;
}

14.#include <stdio.h>
int main(){
for(int i=45;i<=89;i++){
if(i%2==0)
printf("%d ",i);
}
return 0;
}

15. #include <stdio.h>


int main(){
for(int i=1;i<=5;i++){
if(i%2!=0)
printf("%d ",i);
}
return 0;
}

16. #include <stdio.h>


int main(){
for(int i=1;i<=10;i++){
if(i%2!=0)
printf("%d ",i);
}
return 0;
}

17. #include <stdio.h>


int main(){
for(int i=1;i<=100;i++){
if(i%2!=0)
printf("%d ",i);
}
return 0;
}

18. #include <stdio.h>


int main(){
for(int i=50;i<=100;i++){
if(i%2!=0)
printf("%d ",i);
}
return 0;
}

19. #include <stdio.h>


int main(){
for(int i=10;i>=1;i--){
if(i%2!=0)
printf("%d ",i);
}
return 0;
}

20.#include <stdio.h>
int main(){
for(int i=100;i>=1;i--){
if(i%2!=0)
printf("%d ",i);
}
return 0;
}

21.#include <stdio.h>
int main(){
int sum=0;
for(int i=1;i<=5;i++){
sum = sum + i;
}
printf("%d",sum);
return 0;
}

22. #include <stdio.h>


int main(){
int sum=0;
for(int i=1;i<=10;i++){
sum = sum + i;
}
printf("%d",sum);
return 0;
}

22. #include <stdio.h>

int main()
{
int sum;
for(int i=1;i<=10;i++){

sum = i*2;
printf("%d \n",sum);

return 0;
}

23. #include <stdio.h>

int main()
{
int sum;
int a;
printf ("Enter a number to print table : ");
scanf("%d",&a);
for(int i=1;i<=10;i++){

sum = i*a;
printf("%d \n",sum);

}
return 0;
}

24. #include <stdio.h>

int main()
{
char a;

printf("choose the character 'a' for arsmtrong, 'p' for pallindrome, 'r' for
reverse, 't' for table, 'e', 'o', 's' & 'u' : ");
scanf("%c",&a);

if(a=='a'){
int b, rem, sum = 0;
printf("Enter a number to check Armstrong or not : ");
scanf("%d",&b);
int temp = b;
for (int i=b;i>0;i--) {
rem = b % 10;
sum=sum+rem*rem*rem;
b=b/10;
}

if (temp==sum){
printf("%d is Armstrong.", sum);
} else {
printf("Not Armstrong.");
}
}

else if(a=='p'){
int a,temp,rem,sum=0;

printf("Enter a number to check pallindrome or not : ");


scanf("%d",&a);
temp = a;
for(int i=a;a>0;){
rem = a%10;
sum=sum*10+rem;
a=a/10;

if(sum==temp){
printf("pallindrome");
}else{
printf("not");
}
}

else if(a=='r'){
int a,rem,sum=0;
printf("Enter a number to reverse : ");
scanf("%d",&a);
for(int i=a;a>0;){
rem = a%10;
sum=sum*10+rem;
a=a/10;

printf("%d ",sum);
}

else if(a=='t'){
int sum;
int a;
printf("Enter a number to ptint table : ");
scanf("%d",&a);
for(int i=1;i<=10;i++){

sum = i*a;
printf("%d \n",sum);
}
}

else if(a=='e'){

for(int i=56;i<=89;i++){

if(i%2==0){
printf("%d ",i);
}
}

else if(a=='o'){

for(int i=12;i>=1;i--){

if(i%2==1){
printf("%d ",i);
}
}

else if(a=='s'){

int sum;
for(int i=45;i<=90;i++){

if(i%2==0){

sum += i;
}

}
printf("%d ",sum);

else if(a=='u'){

int sum;
for(int i=89;i>=2;i--){

if(i%2==1){

sum += i;
}

}
printf("%d ",sum);
}
return 0;
}

-----------------------------------------------------------------------------------
-----------------------------------
1. #include<stdio.h>
int main(){
int a=1;
while(a<=10){
printf("%d",a);
a++;
}
return 0;
}

2.#include<stdio.h>
int main(){
int a=1;
while(a<=10){
if(a%2==0){
printf("%d ",a);
}
a++;
}
return 0;
}

3.#include<stdio.h>
int main(){
int a=1;
while(a<=100){
if(a%2==0){
printf("%d ",a);
}
a++;
}
return 0;
}

4. #include<stdio.h>
int main(){
int a=56;
while(a>=56 && a<=99){
if(a%2==0){
printf("%d ",a);
}
a++;
}
return 0;
}

6.#include<stdio.h>
int main(){
int a = 100;
while(a>=1){
if(a%2==0){
printf("%d ",a);
}
a--;
}
return 0;
}
7.#include<stdio.h>
int main(){
int a = 10;
while(a>=1){
if(a%2==0){
printf("%d ",a);
}
a--;
}
return 0;
}

8. #include<stdio.h>
int main(){
int a = 1;
while(a<=100){
if(a%2!=0){
printf("%d ",a);
}
a++;
}
return 0;
}

9. #include<stdio.h>
int main(){
int a=1;
int sum = 0;
while(a<=10){
sum = sum + a;
a++;
}
printf("%d",sum);

return 0;
}

10.#include<stdio.h>
int main(){
int num = 12321;
int count = 0;
while(num>0){
num=num/10;
count++;
}
printf("%d",count);
return 0;
}

11.#include <stdio.h>
int main()
{
int n=546678;
int rem,sum=0;
while(n>0){
rem=n%10;
sum=sum*10+rem;
n=n/10;
}
printf("%d",sum);
return 0;
}

11.#include <stdio.h>

int main()
{
char a;
printf("enter the character");
scanf("%c",&a);
if(a=='e'){
int num;
printf("enter number");
scanf("%d",&num);
if(num%2==0){
printf("even");
}
else{
printf("odd");
}
}
else if(a=='m'){

}
else{
printf("input mismatch");
}
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