0% found this document useful (0 votes)
29 views

Lab

The document contains code snippets for 3 different C programs: 1) Prints size of basic data types, 2) Checks if a character is a vowel, 3) Checks if a number is an Armstrong number.

Uploaded by

Sasi Kumar
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)
29 views

Lab

The document contains code snippets for 3 different C programs: 1) Prints size of basic data types, 2) Checks if a character is a vowel, 3) Checks if a number is an Armstrong number.

Uploaded by

Sasi Kumar
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/ 3

//size of basic data types

#include<stdio.h>

#include<conio.h>

#include <stdio.h>

int main()

printf("\nSize of Basic Data Types!\n");

printf("\nSize of Interger %d \n",sizeof(int));

printf("\nSize of character %d \n",sizeof(char));

printf("\nSize of float %d \n",sizeof(double));

return 0;

}
//vowel or not

#include<stdio.h>

#include<conio.h>

int main()

char ch;

printf("\nEnter a character\n");

scanf("%c", &ch);

// Checking both lower and upper case, || is the OR operator

if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch =='o' || ch=='O' || ch == 'u'
|| ch == 'U')

printf("%c is a vowel.\n", ch);

else

printf("%c isn't a vowel.\n", ch);

return 0;

}
//Armstrong Number

#include<stdio.h>

#include<conio.h>

#include<stdio.h>

int main()

int n,r,sum=0,temp;

printf("enter the number=");

scanf("%d",&n);

temp=n;

while(n>0)

r=n%10;

sum=sum+(r*r*r);

n=n/10;

if(temp==sum)

printf("armstrong number ");

else

printf("not armstrong number");

return 0;

You might also like