Thursday 27 May 2021

C Programs Problems

 

#include<stdio.h>
void main()
{
char varchar;
varchar='A';
printf("%c",varchar);



}

2)
#include<stdio.h>
void main()
{
int a;
for(a=2;(a/2)>=0&&(a/2)<=100;a++)
printf("%d\n",a);}

3)
#include<stdio.h>
void main()
{
int i,j;
for(i=1;i<=10;i++)
{
    for(j=1;j<=10;j++)
    {
        printf("%d\t",i*j);
    }
    printf("%d\n");
}
}

4)
#include<stdio.h>
void main()
{
int i,j;
for(i=1;i<=20;i++)
{
for(j=1;j<=20;j++)
{
printf("%d\t",i*j);
}
printf("%d\n");
}
}

5)
//write a program to find absoolute value of any functions
//author:upendra
#include<stdio.h>
#include<math.h>
void main()
{
int a,Abs_val;
printf("Enter the number to find its absolute value:\n");
scanf("%d",&a);
Abs_val=fabs(a);
printf("Absolute value of number is %d",Abs_val);
}

6.)
// write a program to add character to get third character
//author: Upendra date:10/27/2020
#include <stdio.h>
void main()
{

    char ab;
    int z;
    printf("Enter the two characters:\n");
    scanf("%c%c", &a, &b);
    z = a + b;
    printf("Third character is %c"z);
}

7.)
/*write a program to take addmission in college
on following condition */
#include <stdio.h>
void main()
{
    int percage;
    char gendergame;
    printf("Press M for male \n Press F for female \n Press Y for played game \n Press N for not played game");
    scanf("%c%d%d", &gender, &perc, &age);
    printf("Did you played any game at national level \n");
    scanf("%c"game);
    if ((perc >= 80 && age >= 18 && gender == 'M') || (perc >= 70 && age >= 17 && gender == 'F'))
        ;
    printf("You can take addmission in college");
    {
        else
        {
            if (game == 'Y')
                printf("you can take addmission in sport kota");
            else
                printf("You can't take addmission in college");
        }
    }
}

8.)
#include<stdio.h>
void main()
{
int perc,age;
char gen,game;
printf("press M for male n F for female n Y for played game n N for not played game n");
scanf("%c%d%d",&gen,&perc,&age);
printf("did you played national game");
scanf("%c",&game);
if(perc>=80&&age>=18&&gen=='M'||perc>=70&&age>=17&&gen=='F')
    printf("You can take addmission in college");
}

9.)
#include<stdio.h>
void main()
{
int a=6;
do
{
printf("***********Welcome to air India***************\n");
printf("1.check your bags\n");
printf("2.check to switch off your device\n");
printf("3.check your ticket kept it safe\n");
printf("4.check your seat belt is tied properly\n");
printf("**********Have a Nice Happy journey************\n");
}
while(a<9);

}

10.)
/* write a program to check whether
 the alphabet is vowel or consonant */

#include<stdio.h>
void main()
{
    char ch;
    int n;
    printf("Enter any character:");
    scanf("%c%d",&ch,&n);
    if()


}


No comments:

Python if / else

 Python if / else a1 = int ( input (" Enter the number: \n ")) a2 = int ( input (" Enter the number: \n ")) a3 = int ( i...