C Programming Codes
13.4K subscribers
139 photos
2 videos
12 links
C Programming Codes || Quizzes || DSA

Learn along with the community

Any queries
admin - @Pradeep_saii
Download Telegram
//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👇
👍3🔥1
//practice program 10
#include<stdio.h>
int main()
{ int a=3;
a=!a;
printf("%d",a);
return 0;
}
//comment the output👇
4
#include<stdio.h>
int main()
{ int a=-2;
printf("%d",-a);
return 0;
}
👍2
#include<stdio.h>
int main()
{ int a=2,b=3;
printf("%d",++a-b);
return 0;
}
👍3
#include<stdio.h>
int main()
{ printf("%d",10!=10||5<4&&8);
return 0;
}
// comment the output👇
👍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👇
👍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👇
👍4
//Program to print following pattrn.
/* 12345
12345
12345
12345
12345
*/
#include<stdio.h>
int main()
{ int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
//#patterns
👍9🤯2
//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;
}
👍62
//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;
}
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;
}
👍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;
}
👍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;
}
👍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;
}
👍64
//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;
}
👍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;
}
👍2710💯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;
}
👍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;
}
👍132
#include <stdio.h>
int main() {
int x = 5;
int y = x++;
printf("%d %d", x, y);
return 0;
}
👍24🔥21
Output of above program is?
Anonymous Quiz
25%
5,5
58%
5,6
11%
6,5
5%
6,6
🤔41🤯28👍217💯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.
👍4612🥰1