102. write a c program enter the number is odd ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1,n;
printf("Enter the number\n");
sacnf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2!=0)
printf("odd=%d",i);
getch();
}
103.write a c program to enter the number chrck the number is even odd
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1,even=0,n, odd=0;
printf("Enter the number\n");
scsnf("%d",&n);
for (i=1;i<=5;i++);
{
if(i%2==0)
{
even=even+i;
}
else
{
odd=odd+i;
}
}
printf("even=%d",even);
printf("odd=%d",odd);
etch();
}
104.write a c program to print the 1 to 10 number ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=1;i<=10;i++)
{
printf("%d\n",i);
}
getch();
}
105. wrire c progrm enter the number sum of square ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i, sum=0,n;
printf("Enter the umber\n");
scanf("%d",&n);
for (i=1;i<=n;i++);
{
sum=sum+i*i;
}
printf("sum=%d\n",sum);
getch();
}
106.writw a c program enter the number sume of the cube ?
#include<stdio.h>
#include<conio.h>
void main()
{
int i, sum=0,n;
printf("Enter the umber\n");
scanf("%d",&n);
for (i=1;i<=n;i++);
{
sum=sum+i*i*i;
}
printf("sum=%d",sum);
getch();
}
107.write a c program entr the series and even series square and odd seris sum it?
#include<stdio.h>
#include<conio.h>
void main()
{
int i, sum=0,n;
printf("Enter the umber\n");
scanf("%d",&n);
for (i=1;i<=n;i++);
{
if(i%2==0)
{
sum=sum+i*i;
}
else
{
sum=sum+i;
}
printf("sum=%d\n",sum);
getch();
}
108.write a c program sum of the serries ?
1/1+1/2+1/3.........n;
#include<stdio.h>
#include<conio.h>
void main()
{
int n; sum=0,i;
printf("Enter the umber\n");
scanf("%d",&n);
for (i=1;i<=n;i++);
{
sum=(sum+1/i);
}
printf("sum=%d\n",sum);
}
109. write a c program printf the alphabet charecter ?
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
for(ch=65;ch<=92;ch++)
{
printf("upper case=%c\n",ch);
}
getch();
}
110. write a c program printf the lowwr case ?
#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
for(ch=92;ch<=122;ch++)
{
printf("lower case=%c\n",ch);
}
getch();
}
111. write ac program print the table of 6?
#include<stdio.h>
#include<conio.h>
void main()
{
int n,p;
for(n=1;n<=10;n++)
{
p=n*6;
}
printf("p=%d\n",p);
getch();
}
112.write a c program entre the number find the reverse number ?
#include<stdio.h>
#include<conio.h>
void main()
{
int rev,n;
printf("Enter the number\n");
scanf("%d",&n);
for(;n>0;n=n\10)
{
rev=n%10;
rev=rev*10+rev;
}
printf("rev=%d\n",rev);
getch();
}
113. write a c program enter the number sum of all digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int sum=0,n,a;
printf("Enter the number\n");
scanf("%d",&n);
for(n=1;n>0;n=n\10)
{
a=n%10;
sum=sum+a;
}
printf("sum=%d",sum);
getch();
}
114. write a c program enter the number check the numbre is palidrome ?
#include<stdio.h>
#include<conio.h>
void main()
{
int sum=0,n,opt,a;
printf("Enter the number\n");
scanf("%d",&n);
opt=n
for(n=1;n>0;n/10)
{
a=n%10;
sum=sum*10+a;
}
if(sum==opt)
printf("polidrome=%d\n",sum);
else
printf("not pollydroe=%d\n",sum);
getch();
}
115.write a c program enter the number muliply each digit ?
#include<stdio.h>
#include<conio.h>
void main()
{
int multi=1,n,p;
printf("Enter the number\n");
scanf("%d",&n);
for(n=1;n>0;n=n/10)
{
n=n%10;
multi=multi*n;
}
printf("multi=%d\n",multi);
getch();
}
116.write a c program sum of series
1+2+3+4+5------n;
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0;
clrscr();
for(i=1;i<=5;i++);
{
sum=sum+i;
printf("%d\n",i);
}
printf("sum=%d\n",sum);
getch();
}
117.write a c program sum of seris
1+1+2+2+3+3+4+4-----n
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0;
clrscr();
for(i=1;i<=5;i++);
{
sum=sum+i+i;
printf("%d\n",i);
}
printf("sum=%d\n",sum);
getch();
}
118. write a c program cube of seires
1+8+27+-------n
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0;
clrscr();
for(i=1;i<=5;i++);
{
sum=sum+i+i*i;
printf("%d\n",i);
}
printf("sum=%d\n",sum);
getch();
}
119.write a c program sum of odd number
1+3+5+7-------n
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0;
clrscr();
for(i=1;i<=5;i++);
{
if(i%2!=0)
{
sum=sum+i;
printf("%d\n",i);
}
printf("sum=%d\n",sum);
getch();
}
120. write a c program (1,2,4,7,11-----n)
#include<stdio.h>
#include<conio.h>
void main()
{
int p=1,i;
for(i=1;i<=10i++)
{
printf("%d\n",p);
p=p+1;
}
getch();
}
121.write a c program print the series (0 1 1 2 3 5 8---)
#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c,i;
for(i=1;i<=20;i++)
{
printf("%d\n",a);
c=a+b;
a=b;
b=c;
}
getch();
}
122. write a c program print the series(2 3 4 6 6 9 8--)
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=1;i<=10;i++)
{
printf("%d\n",i*2);
printf("%d\n",i*3);
}
getch();
}
123.write a c program print the series (4 5 8 10 12 15--)
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=1;i<=20;i++)
{
printf("%d\n",i*4);
printf("%d\n",i*5);
}
getch();
}
124. write a c program print the series (1 5 2 4 3 3 2 5 1---)
#include<stdio.h>
#include<conio.h>
void main()
{
int a=1,b=5,i;
for(i=1;i<=10;i++);
{
printf("%d\n",a);
printf("%d\n",b);
a++;
b--;
}
getch();
}
125. write a c program series ( 0 7 26 63 124--)
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int n,i;
for(i=1;i<=5;i++)
{
n=(pow(i 3)-1);
printf("%d\n",n);
}
getch();
}
Lets learn contain the c & c++ programs basic,if else,switch ,loops (while ,do while,for) fuctions,strings ,arrays, and file handling etc
For loop
Subscribe to:
Comments (Atom)
No comments:
Post a Comment