0% found this document useful (0 votes)
21 views14 pages

C Leg

The document contains multiple code snippets written in C programming language. The code snippets demonstrate functions, loops, arrays, conditional statements, and input/output operations. Various mathematical and logical operations are performed on data in the examples.

Uploaded by

shreyansh patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views14 pages

C Leg

The document contains multiple code snippets written in C programming language. The code snippets demonstrate functions, loops, arrays, conditional statements, and input/output operations. Various mathematical and logical operations are performed on data in the examples.

Uploaded by

shreyansh patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

#include <stdio.

h>

void function(int a,float b){

printf("\nHello %d,%0.2f",a,b);

int main() {

function(10,10.7);

function(40,23.7);

function(50,34.6);

function(60,45.5);

return 0;

}
#include <stdio.h>

int abc(int n1,int n2) {

int sum=n1+n2;

return sum;

void main(){

int ans,a,b,c,sum;

printf("enter any two value = ",a,b);

scanf("\n%d",&a);

scanf("\n%d",&b);

sum=(a,b);

c=a+b;

printf("\nans=%d",c);

}
#include <stdio.h>

void fumction(int b,a,c){

scanf("%d",&b);

scanf("%d"&a);

printf("\nhello %d",b);

int main(){

printf("enter an value of any number =");

fumction("b%d");

fumction("b%d");

fumction("b%d");

fumction("b%d");

return 0;

}
#include <stdio.h>

int main() {

int number[5],i,mul=1;

for(i=0;i<=5;++i){

printf("enter number %d:",i*1);

scanf("%d",&number[i]);

mul=mul*number[i],i*i;

printf("sum is :%d",mul);

return 0;

}
#include <stdio.h>

int main() {

int i,n;

for(i=1;i<=10;i++){

for(n=1;n<=i;n++){

printf("%d",n);

printf("\n");

return 0;

}
#include <stdio.h>

int main() {

int ch,n1,n2;

// Write C code here

printf("enter an value of n1 = ");

scanf("\n%d",&n1);

printf("enter an value of n2 = ");

scanf("\n%d",&n2);

printf("enter an number in 1 2 3 = ");

scanf("\n%d",&ch);

switch(ch){

case 1:

printf("%d=",n1+n2);

break;

case 2:

printf("%d=",n1-n2);

break;

case 3:

printf("=%d",n1*n2);

break;
default:

return 0;

}
#include <stdio.h>

int main() {

int i;

// Write C code here

printf("\n1 to 50 odd no");

for(i=1;i<=50;i++)

if(i%2==1)

printf("%d\n",i);

return 0;

}
#include <stdio.h>

int main() {

int i,a,b;

printf("\nenter an value of a =");

scanf("%d",&a);

for(i=1;i<=10;i++)

printf("\n",b=a*i);

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

return 0;

}
#include <stdio.h>

int main(){

int n1,n2,n3,min;

puts("enter three integer numbers");

scanf("%d %d %d",&n1,&n2,&n3);

/* find minimum */

if(n1 < n2)

/* n1 is then n2, n1 is compared with n3 */

if(n1 < n3)

min = n1; /* n1 is smallest */

else

min = n3; /* n3 is smallest */

else

/* n2 is then n1, n2 is compared with n3 */

if(n2 < n3)

min = n2; /* n2 is smallest */


else

min = n3; /* n3 is smallest */

printf("minimum is : %d\n",min);

return 0;

------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------

#include <stdio.h>

int main() {

int i;

for(i=1;i<=10;i++)

printf("shreyansh\n");

}
return 0;

------------------------------------------------------------------------------------------------------------------------------------------

#include <stdio.h>

int main() {

int i;

for(i=1;i<=5;i++)

printf("\n%d",i);

return 0;

-------------------------------------------------------------------------------------------------------------------------------------

#include <stdio.h>
int main() {

int i,a;

printf("\nenter an value of a =");

scanf("%d",&a);

for(i=1;i<=10;i++)

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

Return 0;

You might also like