Loopall 28 Ap
Loopall 28 Ap
Loopall 28 Ap
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;
}
12.#include <stdio.h>
int main(){
for(int i=1;i<=10;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;
}
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;
}
int main()
{
int sum;
for(int i=1;i<=10;i++){
sum = i*2;
printf("%d \n",sum);
return 0;
}
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;
}
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;
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;
}