//practice program 9
#include<stdio.h>
int main()
{ int a=20,b=5,result;
float c=20.0,d=5.0;
printf("%d\n",10+a/4*b);
printf("%f\n",c/d*b+a-b);
return 0;
}
//comment the output👇
#include<stdio.h>
int main()
{ int a=20,b=5,result;
float c=20.0,d=5.0;
printf("%d\n",10+a/4*b);
printf("%f\n",c/d*b+a-b);
return 0;
}
//comment the output👇
👍3🔥1
//practice program 10
#include<stdio.h>
int main()
{ int a=3;
a=!a;
printf("%d",a);
return 0;
}
//comment the output👇
#include<stdio.h>
int main()
{ int a=3;
a=!a;
printf("%d",a);
return 0;
}
//comment the output👇
❤4
👍2
👍3
👍1
#include<stdio.h>
int main()
{ int a=3,b=6,c=2;
printf("%d",a*5&&5||(b/c));
return 0;
}
//comment the output👇
int main()
{ int a=3,b=6,c=2;
printf("%d",a*5&&5||(b/c));
return 0;
}
//comment the output👇
👍4
#include<stdio.h>
int main()
{ int x=3,y=5,a=7,b=6,c=2;
printf("%d",x*y<(a+b)||c);
return 0;
}
//comment the output👇
int main()
{ int x=3,y=5,a=7,b=6,c=2;
printf("%d",x*y<(a+b)||c);
return 0;
}
//comment the output👇
👍4
//Program to print following pattrn.
/* *****
*****
*****
*****
*****
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
/* *****
*****
*****
*****
*****
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
👍6❤2
//Program to print following pattrn.
/* *
**
***
****
*****
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
/* *
**
***
****
*****
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
❤6👍4
//Program to print following pattrn.
/* 1
12
123
1234
12345
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
/* 1
12
123
1234
12345
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
👍5
//Program to print following pattrn.
/* 1
22
333
4444
55555
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
}
return 0;
}
/* 1
22
333
4444
55555
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
}
return 0;
}
👍6🔥1
//Program to print following pattrn.
/* 0
12
345
6789
*/
#include<stdio.h>
int main()
{ int i,j,count=0;
for(i=0;i<4;i++)
{
for(j=0;j<=i;j++)
{
printf("%d",count);
count++;
}
printf("\n");
}
return 0;
}
/* 0
12
345
6789
*/
#include<stdio.h>
int main()
{ int i,j,count=0;
for(i=0;i<4;i++)
{
for(j=0;j<=i;j++)
{
printf("%d",count);
count++;
}
printf("\n");
}
return 0;
}
👍10
//Program to print following pattrn.
/* a
ab
abc
abcd
abcde
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=97;i<=101;i++)
{
for(j=97;j<=i;j++)
{
printf("%c",j);
}
printf("\n");
}
return 0;
}
/* a
ab
abc
abcd
abcde
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=97;i<=101;i++)
{
for(j=97;j<=i;j++)
{
printf("%c",j);
}
printf("\n");
}
return 0;
}
👍6❤4
//Program to print following pattern.
/* 1
12
123
1234
12345
*/
#include<stdio.h>
int main()
{ int i,j,k;
for(i=1;i<=5;i++)
{
for(k=5;k>i;k--)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
/* 1
12
123
1234
12345
*/
#include<stdio.h>
int main()
{ int i,j,k;
for(i=1;i<=5;i++)
{
for(k=5;k>i;k--)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
👍5🔥1
//Program to print following pattern.
/* 1
121
12321
1234321
123454321
*/
#include<stdio.h>
int main()
{ int i,j,k,l;
for(i=1;i<=5;i++)
{
for(k=5;k>i;k--)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("%d",j);
}
for(l=j-2;l>0;l--)
{
printf("%d",l);
}
printf("\n");
}
return 0;
}
/* 1
121
12321
1234321
123454321
*/
#include<stdio.h>
int main()
{ int i,j,k,l;
for(i=1;i<=5;i++)
{
for(k=5;k>i;k--)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("%d",j);
}
for(l=j-2;l>0;l--)
{
printf("%d",l);
}
printf("\n");
}
return 0;
}
👍27❤10💯3😁2🥰1👏1
//calculate power of a number without using pow() function
#include<stdio.h>
int main()
{
int base,exp,res=1,i;
printf("Enter the base:");
scanf("%d",&base);
printf("Enter the exponent:");
scanf("%d",&exp);
for(i=1;i<=exp;i++)
{
res=res*base;
}
printf("%d to the power of %d is :%d",base,exp,res);
return 0;
}
#include<stdio.h>
int main()
{
int base,exp,res=1,i;
printf("Enter the base:");
scanf("%d",&base);
printf("Enter the exponent:");
scanf("%d",&exp);
for(i=1;i<=exp;i++)
{
res=res*base;
}
printf("%d to the power of %d is :%d",base,exp,res);
return 0;
}
👍11😁3
//program to print leap years from m to n'th year
#include<stdio.h>
int main()
{
int m,n;
printf("Enter the year m:");
scanf("%d",&m);
printf("Enter the year n:");
scanf("%d",&n);
do
{
if((m%4==0 && m%100!=0) || (m%400==0))
{
printf("%d is a leap year\n",m);
}
else{
printf("%d is not a leap year\n",m);
}
m+=1;
}while(m<=n);
return 0;
}
#include<stdio.h>
int main()
{
int m,n;
printf("Enter the year m:");
scanf("%d",&m);
printf("Enter the year n:");
scanf("%d",&n);
do
{
if((m%4==0 && m%100!=0) || (m%400==0))
{
printf("%d is a leap year\n",m);
}
else{
printf("%d is not a leap year\n",m);
}
m+=1;
}while(m<=n);
return 0;
}
👍13❤2
👍24🔥2❤1
🤔41🤯28👍21❤7💯7😁4🔥2🥰2
What is an Array ?
An array is a collection of elements of the same data type, and all these elements are stored in contiguous memory locations, which means that they are placed next to each other in the memory. This arrangement makes it easy to access and manipulate individual elements within the array.
An array is a collection of elements of the same data type, and all these elements are stored in contiguous memory locations, which means that they are placed next to each other in the memory. This arrangement makes it easy to access and manipulate individual elements within the array.
👍46❤12🥰1